Skip to content

fix: Make and run script instead of executing command directly #5

fix: Make and run script instead of executing command directly

fix: Make and run script instead of executing command directly #5

Workflow file for this run

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@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: 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@v2
- 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