From 245f1cc375271bc8f963d6f02eca6ab7e6bba293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mads=20M=C3=B8ller=20Jensen?= Date: Sun, 2 Feb 2025 00:22:02 +0100 Subject: [PATCH] Improve step and job separation --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41f707ed..8a42960a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,11 +103,24 @@ jobs: - name: Run tests run: cargo test --locked ${{ env.MSRV_FEATURES }} + release_check: + name: Release check + runs-on: ubuntu-latest + outputs: + IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }} + steps: + - name: Check for release + id: is-release + shell: bash + run: | + unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi + echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT + vscode_extension_package: name: Package vscode extension runs-on: ubuntu-latest - outputs: - VSCE_PATH: ${{ steps.vsce-package.outputs.VSCE_PATH }} + needs: + - release_check defaults: run: working-directory: ./vscode-extension @@ -146,13 +159,22 @@ jobs: with: name: ${{ steps.vsce-package.outputs.VSCE_NAME }} path: ${{ steps.vsce-package.outputs.VSCE_PATH }} + + - name: Publish archives and packages + uses: softprops/action-gh-release@v1 + if: needs.release_check.outputs.IS_RELEASE + with: + files: | + ${{ steps.vsce-package.outputs.VSCE_PATH }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} build: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) runs-on: ${{ matrix.job.os }} needs: - crate_metadata - - vscode_extension_package + - release_check strategy: fail-fast: false matrix: @@ -403,20 +425,12 @@ jobs: name: ${{ steps.debian-package.outputs.DPKG_NAME }} path: ${{ steps.debian-package.outputs.DPKG_PATH }} - - name: Check for release - id: is-release - shell: bash - run: | - unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi - echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT - - name: Publish archives and packages uses: softprops/action-gh-release@v1 - if: steps.is-release.outputs.IS_RELEASE + if: needs.release_check.outputs.IS_RELEASE with: files: | ${{ steps.package.outputs.PKG_PATH }} ${{ steps.debian-package.outputs.DPKG_PATH }} - ${{ needs.vscode_extension_package.outputs.VSCE_PATH }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}