Skip to content

Commit

Permalink
chore: Add GitHub Actions for release note automation
Browse files Browse the repository at this point in the history
  • Loading branch information
JeongHeanKim committed Sep 6, 2023
1 parent 9ea2862 commit 522c3e2
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/release_note.yml
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

0 comments on commit 522c3e2

Please sign in to comment.