SSH 备忘 #49
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: ISSUE | |
on: | |
issues: | |
types: [opened, edited, deleted, labeled, unlabeled] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
commit_hash: ${{ steps.git-push.outputs.commit_hash }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js 16 | |
uses: actions/setup-node@v2-beta | |
with: | |
node-version: "16" | |
- name: Install Deps | |
run: npm install @actions/github | |
- name: Commit files | |
if: github.event.action == 'opened' || github.event.action == 'edited' || github.event.action == 'labeled' || github.event.action == 'unlabeled' | |
run: | | |
node ./script/update-issue.js | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add ./content | |
git commit -a -m "update content/posts/${{ github.event.issue.number }}.md" | |
- name: Commit files | |
if: github.event.action == 'deleted' | |
run: | | |
node ./script/update-issue.js | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git rm ./content/posts/${{ github.event.issue.number }}.md | |
git commit -a -m "remove content/posts/${{ github.event.issue.number }}.md" | |
- name: Push changes | |
id: git-push | |
run: | | |
git push | |
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
ghpages: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
ref: ${{ needs.build.outputs.commit_hash }} | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "0.78.1" | |
- name: Build | |
run: hugo --minify | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
cname: blog.isayme.org | |
force_orphan: true |