Publish package v4.1.1 #33
Workflow file for this run
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 from tag" | |
on: | |
push: | |
tags: | |
- "v**" | |
permissions: | |
contents: write | |
actions: write | |
jobs: | |
release: | |
name: "Create release" | |
runs-on: ubuntu-latest | |
env: | |
PACKAGE_NAME: "Ruby gem" | |
CHANGELOG_CATEGORY: "Ruby" | |
CHANGELOG_LINK: "https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md" | |
steps: | |
- name: Checkout repository at tag | |
uses: actions/checkout@v4 | |
with: | |
ref: "${{ github.ref }}" | |
- name: Get tag name | |
run: | | |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Get changelog contents from tag | |
run: | | |
# Use sed to remove everything after "-----BEGIN PGP SIGNATURE-----" if it's present | |
# and also always remove the last line of the git show output | |
git show --format=oneline --no-color --no-patch "${{ env.TAG_NAME }}" \ | |
| sed '1,2d' \ | |
| sed '$d' \ | |
| sed '/-----BEGIN PGP SIGNATURE-----/,$d' \ | |
> CHANGELOG_TEXT.txt | |
echo "" >> CHANGELOG_TEXT.txt | |
echo "" >> CHANGELOG_TEXT.txt | |
TAG_NAME_FOR_LINK=$(echo "${{ env.TAG_NAME }}" | sed 's/^v//' | tr -d '.') | |
echo "View the [$PACKAGE_NAME ${{ env.TAG_NAME }} changelog]($CHANGELOG_LINK#$TAG_NAME_FOR_LINK) for more information." >> CHANGELOG_TEXT.txt | |
- name: Submit changelog entry | |
run: | | |
# Prepare JSON payload using jq to ensure proper escaping | |
payload=$(jq -n \ | |
--arg title "$PACKAGE_NAME ${{ env.TAG_NAME }}" \ | |
--arg category "$CHANGELOG_CATEGORY" \ | |
--arg version "$(echo "${{ env.TAG_NAME }}" | sed 's/^v//')" \ | |
--arg changelog "$(cat CHANGELOG_TEXT.txt)" \ | |
--arg assignee "${{ github.actor }}" \ | |
'{ref: "main", inputs: {title: $title, category: $category, version: $version, changelog: $changelog, assignee: $assignee}}') | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.INTEGRATIONS_CHANGELOG_TOKEN }}" \ | |
-H "Accept: application/vnd.github+json" \ | |
--fail-with-body \ | |
https://api.github.com/repos/appsignal/appsignal.com/actions/workflows/102125282/dispatches \ | |
-d "$payload" |