projects

saturn

My website

feat: move to gitea - again

daniel daum committed parent b06d946 commit 54733b4Signed, not verified

SignedGitea couldn't verify the signature.

Showing 5 changed files with 74 additions and 83 deletions.

.gitea/workflows/deploy.yamladded +34 −0
@@ -0,0 +1,34 @@1# deploys the site to cloudflare pages on every push to main. copies every2# tracked file except the ones that never go live (see the grep below).3# needs the CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID secrets4name: Deploy56on:7    push:8        branches:9            - main10    workflow_dispatch:1112jobs:13    deploy:14        runs-on: ubuntu-latest15        steps:16            - name: Checkout17              uses: actions/checkout@v41819            - name: Stage public files20              run: |21                  set -euo pipefail22                  mkdir dist23                  git ls-files -z \24                      | grep -zv -e '^internal/' -e '^scripts/' -e '^social/' -e '^\.gitea/' -e '^\.gitignore$' -e '^mise\.toml$' \25                      | xargs -0 cp --parents -t dist2627            # from social/ so wrangler finds its functions and wrangler.toml28            - name: Deploy to Cloudflare Pages29              working-directory: social30              env:31                  CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}32                  CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}33                  WRANGLER_SEND_METRICS: "false"34              run: npx --yes wrangler@4 pages deploy ../dist --project-name=saturn --branch=main
.gitea/workflows/mirror.yamladded +39 −0
@@ -0,0 +1,39 @@1# mirrors main to github and tangled on every push. gitea is the source of2# truth, so both get force-pushed to match it. the same file works in every3# repo: it pushes to the repo with the same name on github and tangled.4# needs the GH_MIRROR_TOKEN and TANGLED_MIRROR_KEY secrets5name: Mirror67on:8    push:9        branches:10            - main11    workflow_dispatch:1213jobs:14    mirror:15        runs-on: ubuntu-latest16        env:17            REPO: ${{ github.event.repository.name }}18        steps:19            # full history, and origin/main is the newest main, so a late or20            # retried run never rolls the mirrors back21            - name: Checkout22              uses: actions/checkout@v423              with:24                  fetch-depth: 02526            - name: Mirror to GitHub27              run: |28                  set -euo pipefail29                  git push --force "https://x-access-token:${{ secrets.GH_MIRROR_TOKEN }}@github.com/daniel-daum/${REPO}.git" refs/remotes/origin/main:refs/heads/main3031            - name: Mirror to Tangled32              run: |33                  set -euo pipefail34                  mkdir -p ~/.ssh35                  printf '%s\n' "${{ secrets.TANGLED_MIRROR_KEY }}" > ~/.ssh/tangled36                  chmod 600 ~/.ssh/tangled37                  ssh-keyscan tangled.org >> ~/.ssh/known_hosts38                  export GIT_SSH_COMMAND="ssh -i ~/.ssh/tangled -o IdentitiesOnly=yes"39                  git push --force "git@tangled.org:danieldaum.net/${REPO}" refs/remotes/origin/main:refs/heads/main
.tangled/workflows/deploy.ymldeleted +0 −36
@@ -1,36 +0,0 @@1# deploys the site to cloudflare pages on every push to main. copies every2# tracked file except the ones that never go live (see the grep below).3# needs the CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID secrets45when:6  - event: ["push", "manual"]7    branch: ["main"]89engine: "nixery"1011# wrangler comes from npm at deploy time: the nixpkgs package makes a huge12# image that nixery is slow to build13dependencies:14  nixpkgs:15    - gnugrep16    - findutils17    - nodejs1819environment:20  WRANGLER_SEND_METRICS: "false"2122steps:23  - name: "Stage public files"24    command: |25      set -euo pipefail26      mkdir dist27      git ls-files -z \28          | grep -zv -e '^internal/' -e '^scripts/' -e '^social/' -e '^\.tangled/' -e '^\.gitignore$' -e '^mise\.toml$' \29          | xargs -0 cp --parents -t dist3031  # from social/ so wrangler finds its functions and wrangler.toml32  - name: "Deploy to Cloudflare Pages"33    command: |34      set -euo pipefail35      cd social36      npx --yes wrangler@4 pages deploy ../dist --project-name=saturn --branch=main
.tangled/workflows/mirror.ymldeleted +0 −46
@@ -1,46 +0,0 @@1# mirrors main to github and gitea on every push. tangled is the source of2# truth, so both get force-pushed to match it. the same file works in every3# repo: it pushes to the repo with the same name on github and gitea.4# needs the GH_MIRROR_TOKEN and GITEA_MIRROR_KEY secrets56when:7  - event: ["push", "manual"]8    branch: ["main"]910engine: "nixery"1112dependencies:13  nixpkgs:14    - openssh1516steps:17  # spindle clones one commit deep (depth: 0 means 1 too), and the mirrors18  # need the whole history. this also points origin/main at the newest main,19  # so a late or retried run never rolls the mirrors back20  - name: "Fetch full history"21    command: |22      set -euo pipefail23      git fetch --unshallow origin2425  - name: "Mirror to GitHub"26    command: |27      set -euo pipefail28      git push --force "https://x-access-token:${GH_MIRROR_TOKEN}@github.com/daniel-daum/${TANGLED_REPO_NAME}.git" refs/remotes/origin/main:refs/heads/main2930  # over ssh to git-ssh, which skips cloudflare. https to git.danieldaum.net31  # goes through it, and its bot protection blocks spindle at random32  - name: "Mirror to Gitea"33    command: |34      set -euo pipefail3536      # ssh refuses to run without a passwd entry, and nixery images have none37      mkdir -p /etc38      [ -e /etc/passwd ] || echo "root:x:0:0:root:${HOME}:/bin/bash" > /etc/passwd3940      mkdir -p "${HOME}/.ssh"41      printf '%s\n' "${GITEA_MIRROR_KEY}" > "${HOME}/.ssh/gitea"42      chmod 600 "${HOME}/.ssh/gitea"43      ssh-keyscan -p 2222 git-ssh.danieldaum.net > "${HOME}/.ssh/known_hosts"4445      export GIT_SSH_COMMAND="ssh -i ${HOME}/.ssh/gitea -o IdentitiesOnly=yes -o UserKnownHostsFile=${HOME}/.ssh/known_hosts"46      git push --force "ssh://git@git-ssh.danieldaum.net:2222/daniel-daum/${TANGLED_REPO_NAME}.git" refs/remotes/origin/main:refs/heads/main
social/README.md +1 −1
@@ -57,7 +57,7 @@ this works on `/about/`, `/now/<slug>/`, `/blog/<slug>/` and `/projects/<slug>/`57575858## deploying595960- **functions:** automatic. on every push, ci (`.tangled/workflows/deploy.yml`) runs wrangler from this folder60- **functions:** automatic. on every push, ci (`.gitea/workflows/deploy.yaml`) runs wrangler from this folder6161- **email worker:** `mise run social-email`, only when `email.js`, `lib.js` or `email.toml` change6262- **secret:** `SOCIAL_SECRET` signs moderation links and like hashes. it's set on both the pages project and the worker:6363  - `wrangler pages secret put SOCIAL_SECRET --project-name saturn`