From 094e0b794dd2e4b1cfedf3cfaf4d7d706d15b4e0 Mon Sep 17 00:00:00 2001 From: yzoug Date: Mon, 25 Nov 2024 00:03:31 +0100 Subject: [PATCH] Add basic Github Actions deployment --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..eefdab1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: Deployer +run-name: Build and deploy zoug.fr +on: + push: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + environment: deploy + steps: + - name: Checkout the current branch + uses: actions/checkout@v4 + + - name: Initialize the ssh-agent + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.CI_SSH_PRIVKEY }} + + - name: Install Zola + run: sudo snap install zola --edge + + - name: Build the website + run: zola build + + - name: Scan the host key + run: ssh-keyscan ${{ CI_SSH_HOSTNAME }} >> ~/.ssh/known_hosts + env: + CI_SSH_HOSTNAME: ${{ secrets.CI_SSH_HOSTNAME }} + + - name: Deploy the website + run: >- + rsync -avx --delete --exclude '.ssh' public/ ${{ CI_SSH_USER }}@${{ CI_SSH_HOSTNAME }}:./ + env: + CI_SSH_HOSTNAME: ${{ secrets.CI_SSH_HOSTNAME }} + CI_SSH_USER: ${{ secrets.CI_SSH_USER }}