diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 0a1615b..00b0999 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -2,6 +2,7 @@ name: CI on: push: + branches: ['**'] pull_request: workflow_dispatch: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72c27ee..364eb24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,7 @@ name: CI on: push: + branches: ['**'] pull_request: workflow_dispatch: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bbd0b86..24a92e5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,8 @@ -name: Publish to Reposilite +name: Build and publish release to Reposilite on: - push: - tags: ['v*', '[0-9]*'] - workflow_dispatch: + release: + types: [created] permissions: contents: read @@ -15,26 +14,22 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-java@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 with: - distribution: temurin + distribution: zulu java-version: '21' - - name: Require Reposilite credentials - env: - REPOSILITE_USERNAME: ${{ secrets.REPOSILITE_USERNAME }} - REPOSILITE_PASSWORD: ${{ secrets.REPOSILITE_PASSWORD }} - run: | - test -n "$REPOSILITE_USERNAME" || { echo 'Missing REPOSILITE_USERNAME secret'; exit 1; } - test -n "$REPOSILITE_PASSWORD" || { echo 'Missing REPOSILITE_PASSWORD secret'; exit 1; } - - name: Resolve release version from tag - shell: bash - run: | - case "$GITHUB_REF" in - refs/tags/*) echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV" ;; - *) echo 'Publishing must be run from a release tag (for example v1.2.3)' >&2; exit 1 ;; - esac - - name: Publish release - env: - REPOSILITE_USERNAME: ${{ secrets.REPOSILITE_USERNAME }} - REPOSILITE_PASSWORD: ${{ secrets.REPOSILITE_PASSWORD }} + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Make Gradle wrapper executable + run: chmod +x ./gradlew + + - name: Test and publish release run: ./gradlew --no-daemon clean test publish + env: + RELEASE_VERSION: ${{ github.event.release.tag_name }} + reposiliteUsername: ${{ secrets.reposiliteUsername }} + reposilitePassword: ${{ secrets.reposilitePassword }}