Release Kyma #146
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
name: Release Kyma | |
on: workflow_dispatch | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
container: | |
image: europe-docker.pkg.dev/kyma-project/prod/test-infra/githubrelease:v20230731-ca8ffad9 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check if not in master | |
id: check_if_master | |
shell: bash | |
run: | | |
if ! [[ "${{ github.ref }}" =~ ^refs/heads/release-.*$ ]] ; then | |
echo "Job must run against a release branch. Stopping." | |
exit 1 | |
fi | |
- name: Check if already released | |
id: check_release | |
shell: bash | |
run: | | |
NEXT_RELEASE=$(cat "VERSION") | |
if [[ $NEXT_RELEASE == main ]]; then | |
echo "You can't create a release with the version set to 'main'" | |
exit 1 | |
fi | |
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://api.github.com/repos/${{ github.event.repository.owner.login }}/${{ github.event.repository.name }}/releases/tags/"${NEXT_RELEASE}") | |
if [[ $RESPONSE != 404* ]]; then | |
echo "The ${NEXT_RELEASE} is already published on github. Stopping." | |
exit 1 | |
fi | |
- name: Generate changelog | |
id: changelog | |
shell: bash | |
env: | |
CONFIG_FILE: .github/package.json | |
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global --add safe.directory '*' | |
git config --global user.email "[email protected]" | |
git config --global user.name "Kyma Bot" | |
export NEW_RELEASE_TITLE="$(cat "VERSION")" | |
export FROM_TAG=$(git describe --tags $(git rev-list --tags) --always | grep -F . | grep -v "-" | head -1) | |
/app/generate-release-changelog.sh | |
- name: Make Kyma release | |
id: make_release | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS_JSON: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
GOOGLE_APPLICATION_CREDENTIALS: 'creds.json' | |
run: | | |
echo $GOOGLE_APPLICATION_CREDENTIALS_JSON | base64 -d > creds.json | |
/githubrelease -targetCommit=${{ github.ref }} \ | |
-kymaChangelog=.changelog/release-changelog.md \ | |
-githubRepoOwner=${{ github.event.repository.owner.login }} \ | |
-githubRepoName=${{ github.event.repository.name }} \ | |
-githubAccessToken=${{ secrets.GITHUB_TOKEN }} \ | |
-releaseVersionFilePath=VERSION |