Skip to content

Commit

Permalink
Merge branch 'main' into btp-test
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalKalke authored Oct 11, 2024
2 parents 3f2ab75 + bb91257 commit ef3e1d1
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/actions/create-k3d-cluster/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
cluster-name: "k3dCluster"
args: >-
--agents 1
--image rancher/k3s:v1.29.3-k3s1
--image rancher/k3s:v1.30.0-k3s1
--port 80:80@loadbalancer
--port 443:443@loadbalancer
--wait
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 3 additions & 24 deletions .github/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ set -E # needs to be set if we want the ERR trap
set -o pipefail # prevents errors in a pipeline from being masked

# Expected variables:
# PULL_BASE_REF - name of the tag
# GITHUB_TOKEN - github token used to upload the template yaml
PULL_BASE_REF=${PULL_BASE_REF?"Define PULL_BASE_REF env"} # name of the tag
GITHUB_TOKEN=${GITHUB_TOKEN?"Define GITHUB_TOKEN env"} # github token used to upload the template yaml
RELEASE_ID=${RELEASE_ID?"Define RELEASE_ID env"} # github token used to upload the template yaml

uploadFile() {
filePath=${1}
Expand Down Expand Up @@ -37,28 +38,6 @@ MODULE_VERSION=${PULL_BASE_REF} make render-manifest
echo "Generated keda-manager.yaml:"
cat keda-manager.yaml

echo "Fetching releases"
CURL_RESPONSE=$(curl -w "%{http_code}" -sL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/kyma-project/keda-manager/releases)
JSON_RESPONSE=$(sed '$ d' <<< "${CURL_RESPONSE}")
HTTP_CODE=$(tail -n1 <<< "${CURL_RESPONSE}")
if [[ "${HTTP_CODE}" != "200" ]]; then
echo "${CURL_RESPONSE}"
exit 1
fi

echo "Finding release id for: ${PULL_BASE_REF}"
RELEASE_ID=$(jq <<< ${JSON_RESPONSE} --arg tag "${PULL_BASE_REF}" '.[] | select(.tag_name == $ARGS.named.tag) | .id')

echo "Got '${RELEASE_ID}' release id"
if [ -z "${RELEASE_ID}" ]
then
echo "No release with tag = ${PULL_BASE_REF}"
exit 1
fi

echo "Updating github release with assets"
UPLOAD_URL="https://uploads.github.com/repos/kyma-project/keda-manager/releases/${RELEASE_ID}/assets"

Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,22 @@ jobs:
- name: Create changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/scripts/create_changelog.sh ${{ github.event.inputs.name }}
run: ./.github/scripts/create-changelog.sh ${{ github.event.inputs.name }}

- name: Create draft release
id: create-draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_ID=$(./.github/scripts/create_draft_release.sh ${{ github.event.inputs.name }})
RELEASE_ID=$(./.github/scripts/create-draft-release.sh ${{ github.event.inputs.name }})
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
- name: Create release assets
id: create-assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_BASE_REF: ${{ github.event.inputs.name }}
RELEASE_ID: ${{ steps.create-draft.outputs.release_id }}
run: ./.github/scripts/release.sh

outputs:
Expand Down Expand Up @@ -133,4 +134,4 @@ jobs:
- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/scripts/publish_release.sh ${{ needs.create-draft.outputs.release_id }} ${{ github.event.inputs.latest_release }}
run: ./.github/scripts/publish-release.sh ${{ needs.create-draft.outputs.release_id }} ${{ github.event.inputs.latest_release }}

0 comments on commit ef3e1d1

Please sign in to comment.