61 lines
2.0 KiB
YAML
61 lines
2.0 KiB
YAML
name: Update Website
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 * * * *' # every hour on the hour
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'website/**'
|
|
- 'scripts/website-verify.sh'
|
|
- '.forgejo/workflows/website.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Build & Update Website
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
|
- name: Print runner wait time
|
|
env:
|
|
FORGEJO_TOKEN: ${{ github.token }}
|
|
RUN_NUMBER: ${{ github.run_number }}
|
|
run: |
|
|
runner_start=$(date +%s)
|
|
created_at=$(curl -sf \
|
|
-H "Authorization: token $FORGEJO_TOKEN" \
|
|
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/actions/tasks?limit=100" \
|
|
| python3 -c "import sys,json;data=json.load(sys.stdin);rs=[r for r in data.get('workflow_runs',[]) if r.get('run_number')==$RUN_NUMBER];print(rs[0]['created_at'] if rs else '')" 2>/dev/null)
|
|
if [ -n "$created_at" ]; then
|
|
queued_epoch=$(date -d "$created_at" +%s)
|
|
wait_seconds=$((runner_start - queued_epoch))
|
|
echo "Runner wait time: ${wait_seconds}s (queued at $created_at)"
|
|
else
|
|
echo "Runner wait time: unknown (API lookup failed)"
|
|
fi
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Check runner tools
|
|
run: |
|
|
command -v dagger >/dev/null 2>&1 || { echo "ERROR: dagger is not installed in the runner image. Add it to .forgejo/Dockerfile."; exit 1; }
|
|
command -v task >/dev/null 2>&1 || { echo "ERROR: task is not installed in the runner image. Add it to .forgejo/Dockerfile."; exit 1; }
|
|
|
|
- name: Setup Dagger Remote Engine
|
|
env:
|
|
SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }}
|
|
run: scripts/setup_dagger_remote.sh
|
|
|
|
- name: Build & Update Website
|
|
env:
|
|
DAGGER_NO_NAG: "1"
|
|
run: task publish-website
|
|
|
|
- name: Verify Website
|
|
env:
|
|
SSH_HOST: ${{ env.WEBSITE_SSH_HOST }}
|
|
run: scripts/website-verify.sh
|