diff options
| author | Павел Жуков <33721692+LeaveMyYard@users.noreply.github.com> | 2023-05-28 12:59:24 +0300 |
|---|---|---|
| committer | Павел Жуков <33721692+LeaveMyYard@users.noreply.github.com> | 2023-05-28 12:59:24 +0300 |
| commit | f39f8ea379eaa8bd8306dc7fbfc5981faab69150 (patch) | |
| tree | 7f387560f3476fff78c0d701db9356d87befaee3 | |
| parent | fb873608d42c13eb5151679a430d8f0159b8bbbb (diff) | |
Rework checking for latest workflow
| -rw-r--r-- | .github/workflows/build-on-release.yml | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/.github/workflows/build-on-release.yml b/.github/workflows/build-on-release.yml index bd743f2..f4c320e 100644 --- a/.github/workflows/build-on-release.yml +++ b/.github/workflows/build-on-release.yml @@ -106,10 +106,23 @@ jobs: security delete-keychain $RUNNER_TEMP/app-signing.keychain-db rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision + check-latest: + needs: build + runs-on: ubuntu-latest + outputs: + IS_LATEST: ${{ steps.check-latest.outputs.release == github.ref_name }} + steps: + - id: check-latest + uses: pozetroninc/github-action-get-latest-release@v0.7.0 + with: + repository: ${{ github.repository }} + excludes: prerelease, draft + # Define MacOS hash job mac-hash: - needs: build + needs: check-latest runs-on: ubuntu-latest + if: steps.check-latest.outputs.IS_LATEST outputs: MAC_BUILD_HASH: ${{ steps.calc-hash.outputs.MAC_BUILD_HASH }} steps: @@ -125,8 +138,9 @@ jobs: # Define Linux hash job linux-hash: - needs: build + needs: check-latest runs-on: ubuntu-latest + if: steps.check-latest.outputs.IS_LATEST outputs: LINUX_BUILD_HASH: ${{ steps.calc-hash.outputs.LINUX_BUILD_HASH }} steps: @@ -144,23 +158,8 @@ jobs: update-formula: needs: [mac-hash, linux-hash] runs-on: ubuntu-latest + if: steps.check-latest.outputs.IS_LATEST steps: - - name: Check if latest release - id: check - run: | - LATEST_RELEASE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/robusta-dev/krr/releases/latest | jq -r .tag_name) - CURRENT_RELEASE=${{ github.ref_name }} - if [ "$LATEST_RELEASE" != "$CURRENT_RELEASE" ]; then - echo "::set-output name=is_latest::false" - else - echo "::set-output name=is_latest::true" - fi - - name: Fail if not latest release - if: steps.check.outputs.is_latest != 'true' - continue-on-error: true - run: | - echo "Not the latest release, cancelling job" - exit 1 - name: Checkout homebrew-krr repository uses: actions/checkout@v2 with: |
