2024-06-02 16:21:15 +00:00
|
|
|
name: hugo-deploy
|
|
|
|
run-name: build and deploy hugo page
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
jobs:
|
|
|
|
deploy:
|
2024-06-02 16:48:46 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2024-06-02 16:21:15 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: '18.x'
|
|
|
|
- run: npm ci
|
|
|
|
- run: npm run build
|
|
|
|
|
2024-06-02 16:40:46 +00:00
|
|
|
- uses: https://github.com/webfactory/ssh-agent@v0.9.0
|
2024-06-02 16:21:15 +00:00
|
|
|
with:
|
|
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
- name: Add known host
|
|
|
|
run: |
|
2024-06-02 16:43:44 +00:00
|
|
|
mkdir -p ~/.ssh
|
|
|
|
chmod 700 ~/.ssh
|
|
|
|
echo "${{ secrets.KNOWN_HOST_KEY }}" > ~/.ssh/known_hosts
|
2024-06-02 16:57:26 +00:00
|
|
|
- name: Install rsync
|
2024-06-02 16:58:50 +00:00
|
|
|
run: |
|
|
|
|
apt-get update
|
2024-06-02 17:01:44 +00:00
|
|
|
apt-get -y install rsync
|
2024-06-02 16:21:15 +00:00
|
|
|
- name: Deploy with rsync
|
2024-06-02 17:03:23 +00:00
|
|
|
run: rsync -atv --delete --progress --checksum --whole-file -e ssh public/ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.DEPLOY_LOCATION }}
|