Skip to content

Commit

Permalink
Add 'is latest release' logic (#267)
Browse files Browse the repository at this point in the history
Pass tag to build step in release workflow

Pass tag in build step
  • Loading branch information
MichalKalke authored Sep 2, 2024
1 parent 6cf3b8a commit fb7848f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/scripts/publish_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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"'}')
8 changes: 7 additions & 1 deletion .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}

0 comments on commit fb7848f

Please sign in to comment.