Add deployment ci
This commit is contained in:
parent
47beab59c7
commit
db2958f46e
1 changed files with 41 additions and 0 deletions
41
.github/workflows/deploy-zh.yml
vendored
Normal file
41
.github/workflows/deploy-zh.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
name: Deploy to remote
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Hugo
|
||||
uses: https://github.com/peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: 'latest'
|
||||
extended: true
|
||||
- name: Build
|
||||
run: hugo --minify
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ./public
|
||||
- name: Deploy to Remote
|
||||
run: |
|
||||
if [ ! -d ~/.ssh ]; then
|
||||
mkdir -p ~/.ssh
|
||||
fi
|
||||
chmod 700 ~/.ssh
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
echo "${{ secrets.SSH_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
|
||||
chmod 644 ~/.ssh/known_hosts
|
||||
apt update && apt install rsync -y
|
||||
rsync -av --delete -e "ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes -p ${{ secrets.SSH_PORT }}" public/ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:${{ secrets.WEB_ROOT }}/mastodon-docs
|
||||
- name: Clean up
|
||||
run: |
|
||||
rm -rf ~/.ssh
|
||||
rm -rf public
|
Loading…
Add table
Add a link
Reference in a new issue