From 50ab28017f112922d2b8b609acfebfff29d02ebd Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Fri, 3 Jan 2025 00:28:56 +0100 Subject: [PATCH] Added: Gitea Workflow --- .gitea/workflows/deploy.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .gitea/workflows/deploy.yaml diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..2eacda6 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,31 @@ +name: Build and Deploy Zola Website + +on: + push: + branches: + - master +env: + HOST: ${{ secrets.SERVER_IP }} + SSH_USERNAME: ${{ secrets.USERNAME }} + SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }} + DEST_FOLDER: "/srv/www/cz/filiprojek/fuelstats" + +jobs: + build_and_deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Deploy + run: | + apt update -y && apt-get install -y --no-install-recommends rsync + eval "$(ssh-agent -s)" + ssh-add - <<< "${SSH_PRIVATE_KEY}" + mkdir -p ~/.ssh/ + ssh-keyscan -H ${HOST} >> ~/.ssh/known_hosts + rsync -r --delete-after ./* "${SSH_USERNAME}@${HOST}:${{ env.DEST_FOLDER }}" + + - name: Copy environment.php + ssh ${SSH_USERNAME}@${HOST} "cp /var/websrvenv/environment.php ${env.DEST_FOLDER}/config/environment.php"