2024-11-12 21:48:30 +11:00
|
|
|
name: Deploy files
|
|
|
|
run-name: ${{ gitea.actor }} is deployeing files
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
update-stack:
|
|
|
|
runs-on: stack-runner
|
|
|
|
steps:
|
|
|
|
- name: System update and upgrade
|
|
|
|
run: |
|
|
|
|
apt-get update && \
|
|
|
|
apt-get upgrade -y && \
|
|
|
|
apt-get install -y ssh rsync
|
|
|
|
- name: Create SSH private key
|
|
|
|
run: |
|
2024-11-12 21:53:52 +11:00
|
|
|
mkdir -p .ssh/
|
2024-11-12 21:55:11 +11:00
|
|
|
echo "${{secrets.SSH_PRIV_KEY}}" | tr -d '\r' > .ssh/id_rsa
|
2024-11-12 21:48:30 +11:00
|
|
|
chmod 600 .ssh/id_rsa
|
|
|
|
- name: Retrieve Git serveur hostname and port
|
|
|
|
env:
|
|
|
|
SRV_URL: ${{gitea.server_url}}
|
|
|
|
run: echo "SRV_HOST_PORT=${SRV_URL#*//}" >> $GITEA_ENV
|
|
|
|
- name: Respository clone
|
|
|
|
run: git clone http://${{secrets.STACK_UPDATER_USER}}:${{secrets.STACK_UPDATER_TOKEN}}@${{env.SRV_HOST_PORT}}/${{gitea.repository}}.git ./repo
|
|
|
|
- name: Deploy files
|
2024-11-12 21:57:37 +11:00
|
|
|
run: rsync -e "ssh -o StrictHostKeyChecking=accept-new -i .ssh/id_rsa -p ${{secrets.SSH_PORT}} -l ${{secrets.SSH_USER}}" -avzr --delete --exclude=".git/*" --exclude=".gitea/*" ./repo ${{secrets.SSH_HOST}}:/
|