From 86aa5f9c518540c3ccd0fe3e9503fdcf20e5a7e2 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 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 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..1273e22 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +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: Copy private key to runner + env: + PRIVKEY: ${{ secrets.CI_SSH_PRIVKEY }} + run: echo "$PRIVKEY" > ~/.ssh/id_ed25519 + + - name: Install Zola + run: sudo snap install zola --edge + + - name: Build the website + run: zola build + + - name: Scan the host key + env: + HOST: ${{ secrets.CI_SSH_HOSTNAME }} + run: ssh-keyscan $HOST > ~/.ssh/known_hosts + + - name: Deploy the website + env: + USER: ${{ secrets.CI_SSH_USER }} + HOST: ${{ secrets.CI_SSH_HOSTNAME }} + run: rsync -avx -e "ssh -i ~/.ssh/id_ed25519" --delete --exclude '.ssh' public/ $USER@$HOST:./