2024-12-14 16:25:39 #2
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: Deploy | |
permissions: | |
contents: write | |
on: push | |
jobs: | |
push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install node environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Check out Git repository | |
uses: | |
actions/checkout@v4 | |
# with: | |
# token: {{ secrets.ACCESS_TOKN }} | |
- name: Install dependency | |
run: | | |
npm i -g pnpm | |
pnpm i | |
- name: Build | |
run: pnpm run build | |
- name: Push Deploy Branch | |
run: | | |
cd ./dist | |
git init | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git add -A | |
git commit -m 'deploy' | |
git checkout -b deploy | |
git push -f https://${{secrets.ACCESS_TOKN}}@github.com/JQiue/jqiue-notes.git deploy | |
- name: Executing remote ssh commands using ssh key | |
uses: appleboy/ssh-action@v0.1.8 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
script_stop: true | |
script: | | |
bash | |
cd jqiue-notes/ | |
git fetch && git reset --hard origin/deploy |