From e9d02c8a2aa3deebbfda9fc389eb97dbdc691fcd Mon Sep 17 00:00:00 2001 From: Marlon Saglia Date: Fri, 20 Sep 2024 09:57:20 +0200 Subject: [PATCH] feat(publish-cli): Checkout repository at tagged version and bypass diff checks The changes in this commit address the following: 1. Checkout the repository at the tagged version to ensure the correct code is used for the release. 2. Bypass the diff checks when publishing to GitHub and Homebrew, as these checks are already performed in the "prepare" job. --- .github/workflows/publish-cli.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml index 69a0878e6600..52ae67f1678a 100644 --- a/.github/workflows/publish-cli.yml +++ b/.github/workflows/publish-cli.yml @@ -112,8 +112,8 @@ jobs: publish: runs-on: macos-latest - # Publish the CLI only if changes were detected and the event was a push or workflow_dispatch. - if: needs.prepare.outputs.changes-detected == 'true' && contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) + # Publish if there are changes detected or if the workflow was manually triggered. + if: (github.event_name == 'push' && needs.prepare.outputs.changes-detected == 'true') || (github.event_name == 'workflow_dispatch') needs: - prepare - build-test @@ -130,9 +130,12 @@ jobs: VERSION: ${{ needs.prepare.outputs.build-version }} steps: - - uses: actions/checkout@v4 + - name: Checkout Repository at tagged version + uses: actions/checkout@v4 with: fetch-depth: 0 + # Prefix the version with "v" to checkout the tag. + ref: "v${{ needs.prepare.outputs.build-version }}" - uses: actions/download-artifact@v4 with: @@ -151,13 +154,15 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - make clean dist-github + # Release to Github directly, bypassing the diff check as we already perform this check in the "prepare" job. + make -- --dist-github - name: Publish to Homebrew env: HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} run: | - make clean dist-homebrew + # Release to Homebrew directly, bypassing the diff check as we already perform this check in the "prepare" job. + make -- --dist-homebrew - name: Install via Homebrew run: |