-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading changelog - automate release bodies #192
Comments
I came across this issue while automating release bodies with a changelog generated from git commits since previous release. Thought I'd share my experience and the resulting workflow. In my case, I found the For the following workflow, pushed git tags trigger releases while git-cliff generates the changelog for release body from latest (unreleased) commits. Resulting workflow file# - remove version from `tauri.conf.json` so it's managed by `Cargo.toml`
# - create git-cliff's `cliff.toml` config file with `git cliff --init`
name: "publish"
on:
push:
tags:
- "v*"
# On each push of a `v*` git tag it will create or update a GitHub release with a generated changelog, build your app, and upload the artifacts to the release.
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
- name: install frontend dependencies
run: npm install # change this to npm, pnpm or bun depending on which one you use.
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
shell: bash
# for cross-platform build compat, use perl
- name: Update the Tauri App version with tag version
run: |
perl -pi -e 's/^version = ".*"/version = "${{ env.VERSION }}"/' src-tauri/Cargo.toml
- name: install git-cliff
run: cargo install git-cliff || true
- name: generate changelog
id: changelog
run: |
echo 'changelog<<EOF' >> $GITHUB_OUTPUT
git-cliff --latest --strip all --use-branch-tags >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v${{ env.VERSION }}
releaseName: v${{ env.VERSION }}
releaseBody: "${{ steps.changelog.outputs.changelog }}"
releaseDraft: true
prerelease: true
args: ${{ matrix.args }} Changes to examples/publish-to-auto-release.yml: name: "publish"
on:
push:
- branches:
- - release
+ tags:
+ - "v*"
# This is the example from the readme.
# On each push to the `release` branch it will create or update a GitHub release, build your app, and upload the artifacts to the release.
@@ -28,6 +29,9 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ fetch-tags: true
- name: setup node
uses: actions/setup-node@v4
@@ -49,15 +53,34 @@ jobs:
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.
- name: install frontend dependencies
run: yarn install # change this to npm, pnpm or bun depending on which one you use.
+
+ - name: Extract version from tag
+ run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
+ shell: bash
+
+ # for cross-platform build compat, use perl
+ - name: Update the Tauri App version with tag version
+ run: |
+ perl -pi -e 's/^version = ".*"/version = "${{ env.VERSION }}"/' src-tauri/Cargo.toml
+
+ - name: install git-cliff
+ run: cargo install git-cliff || true
+
+ - name: generate changelog
+ id: changelog
+ run: |
+ echo 'changelog<<EOF' >> $GITHUB_OUTPUT
+ git-cliff --latest --strip all --use-branch-tags >> $GITHUB_OUTPUT
+ echo 'EOF' >> $GITHUB_OUTPUT
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
- releaseName: "App v__VERSION__"
- releaseBody: "See the assets to download this version and install."
+ tagName: v${{ env.VERSION }}
+ releaseName: v${{ env.VERSION }}
+ releaseBody: "${{ steps.changelog.outputs.changelog }}"
releaseDraft: true
args: ${{ matrix.args }} |
Hi there! Thanks for creating and maintaining this.
I recently came across this github action: create-gh-release-action, which parses the
CHANGELOG.md
file and uses that to create a body for the release.Might be cool this action supports a similar thing.
Users can also manually set it up using changelog-reader:
But it would be even better if this was natively supported by this action.
The text was updated successfully, but these errors were encountered: