Skip to content

Commit 274a7ab

Browse files
committed
Add automatic public changelog entry publish
Copy the setup from our integration repositories to automatically create a PR on the public changelog when we release a new version. Closes #34
1 parent 560c939 commit 274a7ab

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Create release from tag"
2+
3+
on:
4+
push:
5+
tags:
6+
- "v**"
7+
8+
permissions:
9+
contents: write
10+
actions: write
11+
12+
jobs:
13+
release:
14+
name: "Create release"
15+
runs-on: ubuntu-latest
16+
env:
17+
PACKAGE_NAME: "Wrap"
18+
CHANGELOG_CATEGORY: "Wrap"
19+
CHANGELOG_LINK: "https://github.com/appsignal/appsignal-wrap/blob/main/CHANGELOG.md"
20+
steps:
21+
- name: Checkout repository at tag
22+
uses: actions/checkout@v4
23+
with:
24+
ref: "${{ github.ref }}"
25+
26+
- name: Get tag name
27+
run: |
28+
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
29+
30+
- name: Get changelog contents from tag
31+
run: |
32+
# Use sed to remove everything after "-----BEGIN PGP SIGNATURE-----" if it's present
33+
# and also always remove the last line of the git show output
34+
git show --format=oneline --no-color --no-patch "${{ env.TAG_NAME }}" \
35+
| sed '1,3d' \
36+
| sed '$d' \
37+
| sed '/-----BEGIN PGP SIGNATURE-----/,$d' \
38+
> CHANGELOG_TEXT.txt
39+
40+
echo "" >> CHANGELOG_TEXT.txt
41+
42+
TAG_NAME_FOR_LINK=$(echo "${{ env.TAG_NAME }}" | sed 's/^v//' | tr -d '.')
43+
echo "View the [$PACKAGE_NAME ${{ env.TAG_NAME }} changelog]($CHANGELOG_LINK#$TAG_NAME_FOR_LINK) for more information." >> CHANGELOG_TEXT.txt
44+
45+
- name: Submit changelog entry
46+
run: |
47+
# Prepare JSON payload using jq to ensure proper escaping
48+
payload=$(jq -n \
49+
--arg title "$PACKAGE_NAME ${{ env.TAG_NAME }}" \
50+
--arg category "$CHANGELOG_CATEGORY" \
51+
--arg version "$(echo "${{ env.TAG_NAME }}" | sed 's/^v//')" \
52+
--arg changelog "$(cat CHANGELOG_TEXT.txt)" \
53+
--arg assignee "${{ github.actor }}" \
54+
'{ref: "main", inputs: {title: $title, category: $category, version: $version, changelog: $changelog, assignee: $assignee}}')
55+
56+
curl -X POST \
57+
-H "Authorization: token ${{ secrets.INTEGRATIONS_CHANGELOG_TOKEN }}" \
58+
-H "Accept: application/vnd.github+json" \
59+
--fail-with-body \
60+
https://api.github.com/repos/appsignal/appsignal-web/actions/workflows/create_integrations_changelog_entry.yml/dispatches \
61+
-d "$payload"

0 commit comments

Comments
 (0)