From 898b2fcc4b49d142f83510ee210558641dd24dc0 Mon Sep 17 00:00:00 2001 From: Will Molloy Date: Sun, 23 Jun 2024 21:13:50 +1200 Subject: [PATCH] Separate the `release` job Co-authored-by: Ji --- .github/workflows/build.yml | 29 +++-------------------------- .github/workflows/release.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23758a7..5c3a390 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,9 +5,6 @@ on: push: branches: [ main ] -permissions: - contents: write - jobs: build: runs-on: ${{ matrix.os }} @@ -27,7 +24,7 @@ jobs: - name: Build run: | chmod +x gradlew - ./gradlew projects clean build --no-daemon --refresh-dependencies + ./gradlew clean build - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 @@ -51,10 +48,10 @@ jobs: distribution: corretto java-version: 21 - - name: Integration Test + - name: Integration test run: | chmod +x gradlew - ./gradlew projects clean integrationTest --no-daemon --refresh-dependencies + ./gradlew clean integrationTest - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 @@ -62,23 +59,3 @@ jobs: flags: integration-tests-${{ matrix.os }} fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} - - release: - needs: [ build, integration-test ] - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Bump version - id: version - uses: paulhatch/semantic-version@v5.4.0 - - - name: Create GitHub tag and release - uses: softprops/action-gh-release@v2.0.5 - with: - tag_name: ${{ steps.version.outputs.version_tag }} - generate_release_notes: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..57c4820 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: release + +on: + workflow_run: + workflows: [ build ] + types: [ completed ] + branches: [ main ] + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Bump version + id: version + uses: paulhatch/semantic-version@v5.4.0 + + - name: Create GitHub tag and release + uses: softprops/action-gh-release@v2.0.5 + with: + tag_name: ${{ steps.version.outputs.version_tag }} + generate_release_notes: true