From 5208fc13df6aebf61922f788a02478c5f117d1b2 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sun, 10 Mar 2024 17:38:20 +0100 Subject: [PATCH] ci: deploy job --- .forgejo/actions/hugo.yaml | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .forgejo/actions/hugo.yaml diff --git a/.forgejo/actions/hugo.yaml b/.forgejo/actions/hugo.yaml new file mode 100644 index 0000000..4c17918 --- /dev/null +++ b/.forgejo/actions/hugo.yaml @@ -0,0 +1,50 @@ +# deploy on branch (only on master and develop) +# on develop -> will deploy on preview.etoiledebethleem.fr +# on master -> will deploy on etoiledebethleem.fr +name: Deploy workflow + +on: + push: + branches: + - master + - develop + +jobs: + deploy: + runs-on: docker + # by default it runs on a node.js debian image + steps: + - name: Install rsync + run: apt update && apt install -y rsync + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + - run: ls -la + - name: Setup Hugo + env: + HUGO_RELEASE_TYPE: extended + HUGO_VERSION: 0.120.3 + run: | + mkdir ~/hugo + cd ~/hugo + curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_RELEASE_TYPE}_${HUGO_VERSION}_Linux-64bit.tar.gz" --output hugo.tar.gz + tar -xvzf hugo.tar.gz + mv hugo /usr/local/bin + - name: Build + run: hugo --minify + - name: Create Key File + run: install -m 600 -D /dev/null ~/.ssh/id_edsa + - name: Populate Key + run: echo "${{ secrets.SRV06_DEPLOY_WEBSITE_SSH_KEY }}" > ~/.ssh/id_edsa + - name: Upload + env: + OUTPUT_PATH: "/warmd/etoiledebethleem/websites/main/${{ GITHUB_BASE_REF }}" + REMOTE_USER: forgejo_actions_websites + SRV_HOST: srv06.lefuturiste.fr + run: | + rsync --perms --archive --stats \ + -e 'ssh -i ~/.ssh/id_edsa -o StrictHostKeyChecking=no' ./public \ + ${REMOTE_USER}@${SRV_HOST}:${OUTPUT_PATH} + +