test #4
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 blog | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v2 | |
- name: prepare node env | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "18.18.0" | |
- uses: webfactory/ssh-agent@v0.7.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: set github profile | |
run: | | |
git config --global user.name 'Deepcity' | |
git config --global user.email 'f1159472899@163.com' | |
- name: hexo generate | |
run: | | |
npm i -g hexo | |
npm i | |
hexo clean && hexo g && hexo d | |
- name: ssh remove server | |
uses: appleboy/ssh-action@v1.0.0 | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
script: | | |
cd blog | |
git pull origin master --rebase | |
sudo nginx -s reload |