From d3c49bcc7832f0cfb42c374b6bbc2bf57ebf0c28 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Thu, 7 Dec 2023 21:22:20 +0100 Subject: [PATCH] Added Gitea Actions workflow files for CI/CD --- .gitea/workflows/build.yaml | 21 ++++++++++++ .gitea/workflows/build_and_deploy.yaml | 44 ++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .gitea/workflows/build.yaml create mode 100644 .gitea/workflows/build_and_deploy.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..5b4b9c6 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,21 @@ +name: Build Zola Website + +on: pull_request + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Zola + uses: taiki-e/install-action@v2 + with: + tool: zola@0.17.2 + + - name: Build Zola Website + run: | + zola build + diff --git a/.gitea/workflows/build_and_deploy.yaml b/.gitea/workflows/build_and_deploy.yaml new file mode 100644 index 0000000..4482734 --- /dev/null +++ b/.gitea/workflows/build_and_deploy.yaml @@ -0,0 +1,44 @@ +name: Build and Deploy Zola Website + +on: + push: + branches: + - master + - dev + +jobs: + build_and_deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Zola + uses: taiki-e/install-action@v2 + with: + tool: zola@0.17.2 + + - name: Build Zola Website + run: | + zola build + + - name: Set Destination Folder if MASTER + if: ${{ github.ref == 'refs/heads/master' }} + run: echo "DEST_FOLDER=/srv/www/cz/filiprojek/www" >> $GITHUB_ENV + + - name: Set Destination Folder if DEV + if: ${{ github.ref == 'refs/heads/dev' }} + run: echo "DEST_FOLDER=/srv/www/cz/filiprojek/dev" >> $GITHUB_ENV + + - name: Deploy to server + uses: AEnterprise/rsync-deploy@v1.0.2 + env: + DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} + ARGS: "-e -c -r --delete" + SERVER_PORT: 22 + FOLDER: "./public/" + SERVER_IP: ${{ secrets.SERVER_IP }} + USERNAME: ${{ secrets.USERNAME }} + SERVER_DESTINATION: ${{ env.DEST_FOLDER }} +