-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add GitHub Actions for release note automation
- Loading branch information
1 parent
9ea2862
commit 522c3e2
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Create release tag and release note | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
create-release-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Get previous tag | ||
id: pre_tag | ||
run: | | ||
echo "version=$(curl -L -H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.API_KEY }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/${{ github.repository }}/releases/latest \ | ||
| jq .tag_name \ | ||
| sed 's/"//g')" >> $GITHUB_OUTPUT | ||
- name: Previous tag | ||
run: | | ||
echo "${{ steps.pre_tag.outputs.version }}" | ||
- name: Generate release tag | ||
id: release_tag | ||
run: echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Release tag | ||
run: | | ||
echo "${{ steps.release_tag.outputs.version }}" | ||
- name: Generate release note | ||
id: release_note | ||
run: | | ||
echo "note=$(curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.API_KEY }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \ | ||
-d '{"tag_name":"${{ steps.release_tag.outputs.version }}","target_commitish":"main","previous_tag_name":"${{ steps.pre_tag.outputs.version }}"}' \ | ||
| jq .body \ | ||
| sed 's/"//g')" >> $GITHUB_OUTPUT | ||
- name: Release note debugging 1 | ||
run: | | ||
echo "Authorization: Bearer ${{ secrets.API_KEY }}" | ||
- name: Release note debugging 2 | ||
run: | | ||
echo "https://api.github.com/repos/${{ github.repository }}/releases/generate-notes" | ||
- name: Release note debugging 3 | ||
run: | | ||
echo '{"tag_name":"${{ steps.release_tag.outputs.version }}","target_commitish":"main","previous_tag_name":"${{ steps.pre_tag.outputs.version }}"}' | ||
- name: Release note debugging 4 | ||
run: | | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.API_KEY }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \ | ||
-d '{"tag_name":"${{ steps.release_tag.outputs.version }}","target_commitish":"main","previous_tag_name":"${{ steps.pre_tag.outputs.version }}"}' | ||
- name: Release note | ||
run: | | ||
echo "${{ steps.release_note.outputs.note }}" | ||
- name: Create Release | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.API_KEY }}" \ | ||
-d "{ \"tag_name\": \"${{ steps.release_tag.outputs.version }}\", \"name\": \"${{ steps.release_tag.outputs.version }}\", \"body\": \"${{ steps.release_note.outputs.note }}\"}" \ | ||
https://api.github.com/repos/${{ github.repository }}/releases |