-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (56 loc) · 2.19 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Create release note and deploy GitHub Pages
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
create-release-note:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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: Generate release tag
id: release_tag
run: echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- 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: 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
deploy-github-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
node-version: '20.3.0'
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy GitHub Actions
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.API_KEY }}
publish_dir: ./dist