From fb7848fad920ceaf3f792da7eb6a9605283626a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kalke?= <56382792+MichalKalke@users.noreply.github.com> Date: Mon, 2 Sep 2024 09:20:41 +0200 Subject: [PATCH] Add 'is latest release' logic (#267) Pass tag to build step in release workflow Pass tag in build step --- .github/scripts/publish_release.sh | 3 ++- .github/workflows/create-release.yaml | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/scripts/publish_release.sh b/.github/scripts/publish_release.sh index 2c2452c8..e64b81ee 100755 --- a/.github/scripts/publish_release.sh +++ b/.github/scripts/publish_release.sh @@ -9,6 +9,7 @@ set -E # needs to be set if we want the ERR trap set -o pipefail # prevents errors in a pipeline from being masked RELEASE_ID=$1 +IS_LATEST_RELEASE=$2 REPOSITORY=${REPOSITORY:-kyma-project/warden} GITHUB_URL=https://api.github.com/repos/${REPOSITORY} @@ -20,4 +21,4 @@ CURL_RESPONSE=$(curl -L \ -H "${GITHUB_AUTH_HEADER}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ ${GITHUB_URL}/releases/${RELEASE_ID} \ - -d '{"draft":false}') + -d '{"draft": false, "make_latest": '"$IS_LATEST_RELEASE"'}') diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index 13f318c1..97ff89ae 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -7,6 +7,10 @@ on: description: 'Release name ( e.g. "2.1.3" )' default: "" required: true + latest_release: + description: 'Latest release' + type: boolean + default: false permissions: # used by build images steps id-token: write # This is required for requesting the JWT token @@ -84,6 +88,8 @@ jobs: builds: needs: create-tag uses: ./.github/workflows/_build.yaml + with: + tag: "${{ github.event.inputs.name }}" create-draft: name: Create draft release @@ -137,4 +143,4 @@ jobs: - name: Publish release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./.github/scripts/publish_release.sh ${{ needs.create-draft.outputs.release_id }} + run: ./.github/scripts/publish_release.sh ${{ needs.create-draft.outputs.release_id }} ${{ github.event.inputs.latest_release }}