Skip to content

Create release

Create release #16

name: "Create release"
env:
GITHUB_URL: https://api.github.com/repos/kyma-project/modulectl
on:
workflow_dispatch:
inputs:
tag:
description: "Release version"
default: ""
required: true
since:
description: "Changelog since"
default: ""
required: false
jobs:
validate-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate the release tag
run: ./.github/scripts/validate_release_tag.sh ${{ github.event.inputs.tag }}
- name: Check if release exists
run: ./.github/scripts/get_release_by_tag.sh ${{ github.event.inputs.tag }} ${{ secrets.GITHUB_TOKEN }}
draft-release:
runs-on: ubuntu-latest
needs: validate-release
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/scripts/create_changelog.sh ${{ github.event.inputs.tag }} ${{ github.event.inputs.since }}
- name: Draft release
id: draft-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_ID=$(./.github/scripts/draft_release.sh ${{ github.event.inputs.tag }})
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
- name: Create tag
run: |
git tag ${{ github.event.inputs.tag }}
git push origin ${{ github.event.inputs.tag }} --tags
outputs:
release_id: ${{ steps.draft-release.outputs.release_id }}
create-artifacts:
runs-on: ubuntu-latest
needs: draft-release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Go setup
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: 'go.sum'
- name: "Run 'make build' with version"
run: make build VERSION=${{ github.event.inputs.tag }}
- name: Add binaries to draft release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/scripts/upload_artifacts.sh ${{ github.event.inputs.tag }}
publish-release:
runs-on: ubuntu-latest
needs: [validate-release, draft-release, create-artifacts]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/scripts/publish_release.sh ${{ needs.draft-release.outputs.release_id }}