From 47f3ec8d1f8d324d834d2b892b2260e0d30f6793 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 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 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..e37ae2e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +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@v3 + + - name: Initialize the ssh-agent + uses: webfactory/ssh-agent@v0.4.1 + 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 ${{ secrets.CI_SSH_HOSTNAME }} >> ~/.ssh/known_hosts + + - name: Deploy the website + run: >- + rsync -avx --delete --exclude '.ssh' public/ ${{ secrets.CI_SSH_USER }}@${{ secrets.CI_SSH_HOSTNAME }}:./