From 403d8310f29dfafc0f4a617431fca71a9632cdee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=96=D1=83=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2?= <33721692+LeaveMyYard@users.noreply.github.com> Date: Sun, 28 May 2023 01:57:23 +0300 Subject: Rework skip on not latest update --- .github/workflows/build-on-release.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/build-on-release.yml b/.github/workflows/build-on-release.yml index 1ee966f..8e24ab4 100644 --- a/.github/workflows/build-on-release.yml +++ b/.github/workflows/build-on-release.yml @@ -110,7 +110,6 @@ jobs: mac-hash: needs: build runs-on: ubuntu-latest - if: github.event.release.id == github.event.repository.latest_release.id outputs: MAC_BUILD_HASH: ${{ steps.calc-hash.outputs.MAC_BUILD_HASH }} steps: @@ -148,6 +147,22 @@ jobs: runs-on: ubuntu-latest if: github.event.release.id == github.event.repository.latest_release.id 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: -- cgit v1.2.3