Files
gdb.lgbtqi.app/.gitea/workflows/deploy.yml
Freyja Odinthrir 5c7f947d96
Some checks failed
Build and deploy website. / Build static site. (push) Failing after 2m21s
Build and deploy website. / Connect to deployment host, update, and redeploy docs website. (push) Has been skipped
Try to fix ci again
2025-09-10 20:34:16 -07:00

200 lines
6.1 KiB
YAML

name: Build and deploy website.
on:
push:
branches:
- "master"
jobs:
job1:
name: Build static site.
runs-on: catthehacker-ubuntu
steps:
-
name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"
-
name: Set up docker buildx...
uses: https://github.com/docker/setup-buildx-action@v3
-
name: Login to gitea registry
uses: https://github.com/docker/login-action@v3
with:
registry: gitea.raer.me
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
-
name: Checkout the git repo...
uses: https://github.com/actions/checkout@v3
with:
ref: master
-
name: Checkout the docker build branch...
uses: https://github.com/actions/checkout@v3
with:
ref: master
path: docker
-
name: Install required system packages...
run: |
export DEBIAN_FRONTEND=noninteractive
apt update
apt upgrade -y
apt install -y graphicsmagick p7zip-full
-
name: Use Node.js
uses: https://github.com/actions/setup-node@v2
with:
node-version: '20'
-
name: Install Chrome
run: |
sudo apt install chromium-browser
-
name: Install node dependencies
run: npm ci
-
name: Lint JS code
run: npm test
-
name: Build site
run: npm run build
-
name: Copy dist to docker...
run: npm cache clean --force;cp -a dist docker/.docker/dist
# -
# name: Use Node.js
# uses: https://github.com/actions/setup-node@v2
# with:
# node-version: '20'
-
name: (EN) Generate PDF from HTML
run: |
chromium --headless --print-to-pdf-no-header \
--run-all-compositor-stages-before-draw --print-to-pdf="${{ gitea.workspace }}/dist/en.pdf" \
http://127.0.0.1:8080/en/printable/index.html
-
name: (ZH) Generate PDF from HTML
run: |
chromium --headless --print-to-pdf-no-header \
--run-all-compositor-stages-before-draw --print-to-pdf="${{ gitea.workspace }}/dist/zh.pdf" \
http://127.0.0.1:8080/zh/printable/index.html
-
name: (DE) Generate PDF from HTML
run: |
chromium --headless --print-to-pdf-no-header \
--run-all-compositor-stages-before-draw --print-to-pdf="${{ gitea.workspace }}/dist/de.pdf" \
http://127.0.0.1:8080/de/druckbar/index.html
-
name: (HU) Generate PDF from HTML
run: |
chromium --headless --print-to-pdf-no-header \
--run-all-compositor-stages-before-draw --print-to-pdf="${{ gitea.workspace }}/dist/hu.pdf" \
http://127.0.0.1:8080/hu/nyomtathato/index.html
-
name: (PL) Generate PDF from HTML
run: |
chromium --headless --print-to-pdf-no-header \
--run-all-compositor-stages-before-draw --print-to-pdf="${{ gitea.workspace }}/dist/pl.pdf" \
http://127.0.0.1:8080/pl/do-druku/index.html
-
name: (PT) Generate PDF from HTML
run: |
chromium --headless --print-to-pdf-no-header \
--run-all-compositor-stages-before-draw --print-to-pdf="${{ gitea.workspace }}/dist/pt.pdf" \
http://127.0.0.1:8080/pt/imprimivel/index.html
-
name: (FR) Generate PDF from HTML
run: |
chromium --headless --print-to-pdf-no-header \
--run-all-compositor-stages-before-draw --print-to-pdf="${{ gitea.workspace }}/dist/fr.pdf" \
http://127.0.0.1:8080/fr/a-imprimer/index.html
-
name: (NL) Generate PDF from HTML
run: |
chromium --headless --print-to-pdf-no-header \
--run-all-compositor-stages-before-draw --print-to-pdf="${{ gitea.workspace }}/dist/nl.pdf" \
http://127.0.0.1:8080/nl/afdrukbaar/index.html
-
name: List dist
run: ls -la ${{ gitea.workspace }}/dist
-
name: Upload PDFs
uses: https://github.com/actions/upload-artifact@v3
with:
name: site-pdfs
path: |
${{ gitea.workspace }}/dist/**.pdf
retention-days: 365
-
name: Build and push docker image to gitea package store
uses: https://github.com/docker/build-push-action@v5
with:
context: docker/.docker
push: true
platforms: linux/arm64
tags: gitea.raer.me/${{ gitea.repository }}:${{ gitea.ref_name }}
-
name: Create artifact...
run: 7z a -mx=9 artifact.7z dist
-
name: Upload artifact...
uses: https://github.com/actions/upload-artifact@v3
with:
name: build_artifact
path: artifact.7z
retention-days: 365
job2:
needs: job1
name: Connect to deployment host, update, and redeploy docs website.
runs-on: ubuntu-latest
steps:
-
name: Install required system packages...
run: |
export DEBIAN_FRONTEND=noninteractive
apt update
apt upgrade -y
apt install -y iputils-ping
-
name: Configure SSH...
env:
SSH_USER: ${{ secrets.DEPLOYMENT_USER }}
SSH_KEY: ${{ secrets.DEPLOYMENT_KEY }}
SSH_HOST: ${{ secrets.DEPLOYMENT_HOST }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key
cat >> ~/.ssh/config <<END
Host staging
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
END
cat ~/.ssh/config
-
name: Ping ssh host...
env:
SSH_HOST: ${{ secrets.DEPLOYMENT_HOST }}
run: |
ping -c 3 $SSH_HOST
-
name: Run deployment script...
env:
SSH_HOST: ${{ secrets.DEPLOYMENT_HOST }}
run:
ssh staging