From 1e4e5d368b18ce0bfd833d848a9b65895f1bf17b Mon Sep 17 00:00:00 2001 From: "molly.computer" Date: Fri, 21 Aug 2026 14:19:22 -0400 Subject: [PATCH] Automate tested site deployments --- .gitea/workflows/deploy.yml | 56 +++++++++++++++++++++++++++++++++++++ README.md | 6 +++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..e36ef8b --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,56 @@ +name: Test and deploy + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: cooking-daze-lol + cancel-in-progress: true + +jobs: + build-test-deploy: + runs-on: cooking-linux + timeout-minutes: 15 + steps: + - name: Check out repository + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + submodules: recursive + - name: Set up Hugo + uses: peaceiris/actions-hugo@2752ce1d29631191ea3f27c23495fa06139a5b78 + with: + hugo-version: "0.106.0" + extended: true + - name: Set up Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + with: + node-version: "22" + - name: Build site + run: hugo --minify --panicOnWarning + - name: Smoke test generated site + run: | + set -euo pipefail + test -s public/index.html + test -s public/style.css + test -s public/apple-pie/index.html + grep -Fq "cooking.daze.lol" public/index.html + grep -Fq "personal cookbook" public/index.html + - name: Validate Cloudflare deployment + run: npx --yes wrangler@4.125.0 deploy --dry-run + - name: Deploy to cooking.daze.lol + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + run: npx --yes wrangler@4.125.0 deploy + - name: Verify live site + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + run: curl --fail --retry 5 --retry-delay 3 https://cooking.daze.lol/ >/dev/null diff --git a/README.md b/README.md index c92a4dc..ee8ccee 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,11 @@ case, i.e. `/pix/...`. ## Deployment The site is hosted on the `cooking-daze-lol` Cloudflare Worker as static -assets, with `cooking.daze.lol` attached as its custom domain. To deploy it: +assets, with `cooking.daze.lol` attached as its custom domain. Pushes to +`master` are built, smoke-tested, validated with a Wrangler dry run, and then +deployed by Gitea Actions. Pull requests run the same checks without deploying. + +To deploy manually: ```sh git submodule update --init -- 2.51.2