release-prepare #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
--- | |
# Update versions and create release PR | |
# Source: https://www.thisdot.co/blog/tag-and-release-your-project-with-github-actions-workflows | |
# | |
# For detailed description see "release.yml" | |
name: release-prepare | |
on: workflow_dispatch | |
permissions: | |
contents: write # To push new branch | |
pull-requests: write # To create a pull request | |
jobs: | |
release-prepare: | |
name: version_bump | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
# Automatically determinate the next release version from Conventional Commits since the latest tag | |
- name: Get next version | |
id: semver | |
uses: ietf-tools/semver-action@v1 | |
with: | |
token: ${{ github.token }} | |
branch: main | |
# Bump version | |
- name: Update main.go | |
run: | | |
sed -i -E 's/const firmwareActionVersion = .*/const firmwareActionVersion = "${{ steps.semver.outputs.next }}"/g' action/main.go | |
- name: Update Taskfile.yml | |
run: | | |
sed -i -E "s/SEMVER: .*/SEMVER: '${{ steps.semver.outputs.next }}'/g" Taskfile.yml | |
- name: Update action.yml | |
run: | | |
sed -i -E "s/version=v[a-zA-Z0-9\.]+/version=${{ steps.semver.outputs.next }}/g" action.yml | |
# Changelog | |
- name: Get cocogitto | |
run: | | |
cargo install --locked cocogitto | |
- name: Update changelog | |
run: | | |
cog changelog > CHANGELOG.md | |
- name: Create pull request | |
id: create_pr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: release/${{ steps.semver.outputs.next }} | |
commit-message: 'chore(action): bump version to ${{ steps.semver.outputs.next }}' | |
title: 'Release: ${{ steps.semver.outputs.next }} Pull Request' | |
body: 'Prepare for next release' | |
assignees: 'AtomicFS' | |
reviewers: 'AtomicFS' |