Trigger release #41
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: Trigger release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
type: string | |
required: true | |
permissions: | |
packages: write | |
contents: write | |
pages: write | |
id-token: write | |
env: | |
VERSION_PATTERN: '^\d+\.\d+\.\d+(-alpha\d\d|-rc\d\d)?$' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check if version is valid | |
uses: kaisugi/[email protected] | |
id: regex-match | |
with: | |
text: ${{ inputs.version }} | |
regex: ${{ env.VERSION_PATTERN }} | |
- name: Version does not match the given pattern | |
if: steps.regex-match.outputs.match == '' | |
run: exit 1 | |
- name: Update gradle.properties | |
run: sed -i "s/^version=.*/version=${{ inputs.version }}/" gradle.properties | |
- name: Update Writerside variable | |
run: sed -i 's/\(<var name="kotlinmailer_version" value="\)[^"]*\("\/>\)/\1${{ inputs.version }}\2/' docs/Writerside/v.list | |
- name: Commit changes | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -a -m "chore: Update config files to ${{ inputs.version }}" | |
- name: Tag the commit | |
run: git tag v${{ inputs.version }} | |
- name: Push changes | |
run: | | |
git push origin | |
git push origin tag v${{ inputs.version }} | |
- name: Create release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: v${{ inputs.version }} | |
prerelease: ${{ contains(inputs.version, '-') }} | |
call-docs: | |
needs: release | |
if: ${{ !contains(inputs.version, '-') }} | |
uses: ./.github/workflows/docs-workflow.yml | |
with: | |
version: ${{ inputs.version }} | |
call-maven-publish: | |
needs: release | |
uses: ./.github/workflows/maven-publish-workflow.yml | |
with: | |
version: ${{ inputs.version }} | |
secrets: inherit |