added pipeline
This commit is contained in:
41
.gitea/workflows/pipeline.yml
Normal file
41
.gitea/workflows/pipeline.yml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
name: Deploy on push
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: contains(gitea.event.head_commit.message, '[deploy]')
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install ssh + rsync
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y openssh-client rsync
|
||||||
|
|
||||||
|
- name: Setup SSH
|
||||||
|
env:
|
||||||
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
||||||
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
ssh-keyscan -p 22 "rchou.org" >> ~/.ssh/known_hosts
|
||||||
|
chmod 644 ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Rsync to server
|
||||||
|
env:
|
||||||
|
SSH_TARGET_DIR: /home/cab/docker/blog/src
|
||||||
|
RSYNC_SOURCE: .
|
||||||
|
run: |
|
||||||
|
rsync -rz --delete \
|
||||||
|
--no-times --no-perms --no-owner --no-group \
|
||||||
|
--omit-dir-times --mkpath \
|
||||||
|
-e "ssh -i ~/.ssh/id_ed25519 -p 22" \
|
||||||
|
"$RSYNC_SOURCE"/ "deploy@rchou.org:${SSH_TARGET_DIR}/"
|
||||||
|
|
||||||
Reference in New Issue
Block a user