Create release #18
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: "Create release" | |
env: | |
IMAGE_REPO: europe-docker.pkg.dev/kyma-project/prod/runtime-watcher-skr | |
CODE_REPOSITORY: kyma-project/runtime-watcher | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: "Release name" | |
default: "" | |
required: true | |
since: | |
description: "Changelog since" | |
default: "" | |
required: false | |
jobs: | |
validate-release: | |
name: Validate release | |
runs-on: ubuntu-latest | |
outputs: | |
current_release_tag: ${{ steps.get_current_release_tag.outputs.current_release_tag }} | |
last_release_tag: ${{ steps.get_last_release_tag.outputs.last_release_tag }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Validate the release tag | |
run: ./.github/scripts/release/validate_release_tag.sh ${{ github.event.inputs.name }} | |
- name: Check if release doesn't exist yet | |
run: ./.github/scripts/release/get_release_by_tag.sh ${{ github.event.inputs.name }} ${{ secrets.GITHUB_TOKEN }} | |
draft-release: | |
name: Create draft release | |
runs-on: ubuntu-latest | |
needs: validate-release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate changelog | |
id: generate_changelog | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./.github/scripts/release/create_changelog.sh ${{ github.event.inputs.name }} ${{ github.event.inputs.since }} | |
- name: Draft release | |
id: draft-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
RELEASE_ID=$(./.github/scripts/release/draft_release.sh ${{ github.event.inputs.name }}) | |
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT | |
- name: Create tag | |
run: | | |
git tag ${{ github.event.inputs.name }} | |
git push origin ${{ github.event.inputs.name }} --tags | |
outputs: | |
release_id: ${{ steps.draft_release.outputs.release_id }} | |
builds: | |
needs: draft-release | |
uses: ./.github/workflows/build-image.yml | |
with: | |
tag: "${{ github.event.inputs.name }}" | |
publish_release: | |
name: Publish release | |
needs: [validate-release, draft-release, builds] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Wait for the Docker image | |
timeout-minutes: 20 | |
env: | |
ITERATIONS: 40 | |
SLEEP_SECONDS: 30 | |
run: ./.github/scripts/release/wait_for_image.sh ${{ env.IMAGE_REPO }}:${{ github.event.inputs.name }} $ITERATIONS $SLEEP_SECONDS | |
- name: Publish release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./.github/scripts/release/publish_release.sh ${{ needs.draft-release.outputs.release_id }} |