Create release draft for v0.12.0 #23
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 Draft | |
run-name: Create release draft for ${{ github.event.inputs.version }} | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Version. Use format "v1.0.0", "v1.0.0b1" or "v1.0.0rc1". | |
required: true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSIONS_FILE_PATH: app/version.py | |
jobs: | |
Create-Release-Draft: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print settings | |
run: | | |
echo "Creating draft release..." && \ | |
echo "Repository : ${{ github.repository }}" && \ | |
echo "Branch : ${{ github.ref }}" && \ | |
echo "Version : ${{ github.event.inputs.version }}" | |
- name: Validate version format | |
run: | | |
[[ "${{ github.event.inputs.version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?$ ]] || (echo "Version format is invalid." && exit 1) | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Git config | |
run: | | |
git config --local user.name github-actions[bot] | |
git config --local user.email 25802428+github-actions[bot]@users.noreply.github.com | |
- name: Update version in version script | |
run: | | |
sed -i 's/VERSION = \".\+\"/VERSION = \"${{ github.event.inputs.version }}\"/g' $VERSIONS_FILE_PATH && \ | |
sed -i 's/= "v/= "/g' $VERSIONS_FILE_PATH | |
git commit $VERSIONS_FILE_PATH -m "New version ${{ github.event.inputs.version }}" | |
git push | |
- name: Create tag | |
run: | | |
git tag ${{ github.event.inputs.version }} | |
git push origin ${{ github.event.inputs.version }} | |
- name: Create release draft | |
run: | | |
gh release create ${{ github.event.inputs.version }} --target ${{ github.ref }} --draft --title "${{ github.event.inputs.version }}" --generate-notes --prerelease | |
- name: Reset version to dev version | |
run: | | |
sed -i 's/VERSION = \".\+\"/VERSION = \"0.0.0\"/g' $VERSIONS_FILE_PATH | |
git commit $VERSIONS_FILE_PATH -m "Reset to dev version after creation of release draft" | |
git push --force |