-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use github action create release (#1835)
* refactor create release github action --------- Co-authored-by: Jeremy Harisch <[email protected]> Co-authored-by: Tomasz Smelcerz <[email protected]>
- Loading branch information
1 parent
8474607
commit 9dee979
Showing
11 changed files
with
114 additions
and
146 deletions.
There are no files selected for viewing
23 changes: 14 additions & 9 deletions
23
scripts/release/create_changelog.sh → .github/scripts/release/create_changelog.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o nounset | ||
|
||
set -o errexit | ||
set -E | ||
set -o pipefail | ||
|
||
CURRENT_RELEASE_TAG=$1 | ||
LAST_RELEASE_TAG=$2 | ||
DOCKER_IMAGE_URL=$3 | ||
DOCKER_IMAGE_URL=$2 | ||
LAST_RELEASE_TAG=$3 | ||
|
||
if [ "${LAST_RELEASE_TAG}" == "" ] | ||
then | ||
LAST_RELEASE_TAG=$(git describe --tags --abbrev=0) | ||
fi | ||
|
||
GITHUB_URL=https://api.github.com/repos/$CODE_REPOSITORY | ||
GITHUB_AUTH_HEADER="Authorization: Bearer $GITHUB_TOKEN" | ||
CHANGELOG_FILE="CHANGELOG.md" | ||
|
||
echo "## What has changed" >> $CHANGELOG_FILE | ||
|
||
git log "$LAST_RELEASE_TAG..$CURRENT_RELEASE_TAG" --pretty=tformat:"%h" --reverse | while read -r commit | ||
git log "$LAST_RELEASE_TAG"..HEAD --pretty=tformat:"%h" --reverse | while read -r commit | ||
do | ||
COMMIT_AUTHOR=$(curl -H "$GITHUB_AUTH_HEADER" -sS "$GITHUB_URL"/commits/"$commit" | jq -r '.author.login') | ||
git show -s "$commit" --format="* %s by @$COMMIT_AUTHOR" >> $CHANGELOG_FILE | ||
if [ "${COMMIT_AUTHOR}" != "kyma-bot" ]; then | ||
git show -s "${commit}" --format="* %s by @${COMMIT_AUTHOR}" >> ${CHANGELOG_FILE} | ||
fi | ||
done | ||
|
||
{ | ||
echo -e "\n**Full changelog**: $GITHUB_URL/compare/$LAST_RELEASE_TAG...$CURRENT_RELEASE_TAG" | ||
echo -e "\n" | ||
echo "## Docker image URL" | ||
echo "$DOCKER_IMAGE_URL" | ||
echo "$DOCKER_IMAGE_URL" | ||
} >> $CHANGELOG_FILE | ||
|
||
echo $CHANGELOG_FILE | ||
cat $CHANGELOG_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Build Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # This will get tagged with `latest` and `v{{DATE}}-{{COMMIT_HASH_SHORT}}` | ||
workflow_call: | ||
inputs: | ||
tag: | ||
description: 'Additional tag for built images' | ||
required: false | ||
type: string | ||
default: "" | ||
|
||
permissions: | ||
id-token: write # This is required for requesting the JWT token | ||
contents: read # This is required for actions/checkout | ||
|
||
jobs: | ||
compute-tag: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag: ${{ steps.get_tag.outputs.tag }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Get the latest tag | ||
id: get_tag | ||
run: | | ||
if [[ "${{ inputs.tag }}" != "" ]]; then | ||
echo "tag=${{ inputs.tag }}" >> $GITHUB_OUTPUT | ||
elif [[ "${{ github.event_name }}" == "push" ]]; then | ||
echo "tag=latest" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Echo the tag | ||
run: echo ${{ steps.get_tag.outputs.tag }} | ||
build-image: | ||
needs: compute-tag | ||
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main | ||
with: | ||
name: lifecycle-manager | ||
dockerfile: Dockerfile | ||
context: . | ||
tags: ${{ needs.compute-tag.outputs.tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.