This action allows you to add content to GitHub release notes programmatically. It can be run on any OS supported by GitHub Actions.
Perfect for automatically appending build artifacts info, Docker image tags, deployment details, or any other dynamic content to your release notes after release creation.
on:
release:
types: [published]
jobs:
update-release:
runs-on: ubuntu-latest
steps:
- name: Add Docker tags to release notes
uses: gacts/add-to-release-notes@v1
with:
append: |
## π Docker images
```
ghcr.io/user/repo:v1.2.3
ghcr.io/user/repo:latest
```
- name: Prepend important notice
uses: gacts/add-to-release-notes@v1
with:
prepend: |
> **Warning**
> This release requires migration steps. See [MIGRATION.md](./MIGRATION.md)The following inputs can be used as step.with keys:
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
append |
string |
no | Content to append (at the end) to the release notes | |
prepend |
string |
no | Content to prepend (at the beginning) to the release notes | |
skip-if-contains |
string |
no | If the release notes already contain this string/regex, do not modify them | |
release-id |
string |
${{ github.event.release.id }} |
no | Release ID to update. If not specified, will try to detect from context |
tag-name |
string |
${{ github.ref_name }} |
no | Tag name to find release. Used if release-id is not provided |
github-token |
string |
${{ github.token }} |
no | GitHub auth token. Since there's a default, this is typically not supplied by the user |
| Name | Type | Description |
|---|---|---|
updated-body |
string |
The updated body content with added release notes |
name: Release
on:
release:
types: [published]
jobs:
docker-build:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.tags.outputs.list }}
steps:
- uses: actions/checkout@v5
- {uses: gacts/github-slug@v1, id: slug}
- uses: docker/login-action@v3
with: {registry: ghcr.io, username: '${{ github.actor }}', password: '${{ secrets.GITHUB_TOKEN }}'}
- id: tags
env:
GHCR_IMAGE: ghcr.io/${{ github.repository }}
EXACT: ${{ steps.slug.outputs.version-semantic }}
MINOR: ${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}
MAJOR: ${{ steps.slug.outputs.version-major }}
run: |
echo 'list<<EOF' >> $GITHUB_OUTPUT
echo "$GHCR_IMAGE:$EXACT" >> "$GITHUB_OUTPUT"
echo "$GHCR_IMAGE:$MINOR" >> "$GITHUB_OUTPUT"
echo "$GHCR_IMAGE:$MAJOR" >> "$GITHUB_OUTPUT"
echo "$GHCR_IMAGE:latest" >> "$GITHUB_OUTPUT"
echo 'EOF' >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v6
id: push
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.tags.outputs.list }}
update-release:
runs-on: ubuntu-latest
needs: [docker-build]
steps:
- uses: gacts/add-to-release-notes@v1
with:
append: |
## π Docker images
```
${{ needs.docker-build.outputs.tags }}
```
skip-if-contains: "## π Docker images"- uses: gacts/add-to-release-notes@v1
with:
prepend: |
> **Note**
> Breaking changes in this release!
append: |
## π¦ Assets
- `app-linux-amd64`
- `app-darwin-arm64`- uses: gacts/add-to-release-notes@v1
with:
append: |
## Deployment info
Deployed to production at ${{ github.event.release.created_at }}
skip-if-contains: "Deployment info"- uses: gacts/add-to-release-notes@v1
with:
append: "## Build #${{ github.run_number }}"
skip-if-contains: '## Build #\d+'- uses: gacts/add-to-release-notes@v1
with:
tag-name: v1.2.3
append: |
## Hotfix applied
Security patch included- uses: gacts/add-to-release-notes@v1
with:
release-id: 123456789
prepend: "β οΈ **Deprecated:** This release is no longer supported"To release a new version:
- Build the action distribution (
make buildornpm run build). - Commit and push changes (including
distdirectory changes - this is important) to themaster|mainbranch. - Publish the new release using the repo releases page (the git tag should follow the
vX.Y.Zformat).
Major and minor git tags (v1 and v1.2 if you publish a v1.2.Z release) will be updated automatically.
Tip
Use Dependabot to keep this action updated in your repository.
If you find any errors in the action, please create an issue in this repository.
This is open-source software licensed under the MIT License.