From cb29f90c6998b62b2e6c18476ea2bcef9721ebc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alo=C3=AFs=20Micard?= Date: Mon, 23 Dec 2024 12:59:08 +0100 Subject: [PATCH] Add CI/CD --- .forgejo/workflows/deploy.yaml | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .forgejo/workflows/deploy.yaml diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml new file mode 100644 index 0000000..64df19a --- /dev/null +++ b/.forgejo/workflows/deploy.yaml @@ -0,0 +1,48 @@ +name: Deploy + +on: [ push ] +jobs: + build: + runs-on: docker + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Cache Hugo binary + id: cache-hugo + uses: actions/cache@v4 + with: + path: hugo + key: ${{ runner.os }}-hugo + + - name: Download Hugo + if: steps.cache-hugo.outputs.cache-hit != 'true' + run: | + curl -L -o hugo_0.140.0_linux-amd64.tar.gz https://github.com/gohugoio/hugo/releases/download/v0.140.0/hugo_0.140.0_linux-amd64.tar.gz + tar zxvf hugo_0.140.0_linux-amd64.tar.gz + + - name: Build website + run: ./hugo + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: website + path: public/ + + deploy: + runs-on: docker + steps: + - uses: actions/download-artifact@v3 + with: + name: website + + - name: Install lftp + run: | + apt update + apt install -y lftp + + - name: Deploy website + run: lftp -c "open -u ${{ secrets.FTP_USER }},${{ secrets.FTP_PASS }} ${{ secrets.FTP_HOST }}; mirror -R . ~/${{ secrets.FTP_DIR }}; quit" \ No newline at end of file