# The update button: on GitHub, Actions → Update Dozokit Links → Run workflow. # It takes the latest release, checks it was signed by Dozokit's release key (the line below), # keeps your wrangler.jsonc (it holds your database's id) and this folder, and pushes. # Cloudflare then rebuilds and deploys, database changes included. name: Update Dozokit Links on: workflow_dispatch permissions: contents: write jobs: update: if: github.repository != 'dozokit/links' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - env: GH_TOKEN: ${{ github.token }} RELEASE_KEY: dozokit namespaces="git" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOEPrmKJvjC7n7NoGG5xPoZUk8kSx6Z5BNARnPuXEfYD run: | tag=$(gh api repos/dozokit/links/releases/latest --jq .tag_name) echo "$tag" | grep -Eqx 'v[0-9]+\.[0-9]+\.[0-9]+' || { echo "The latest release has no version number ($tag). Nothing changed."; exit 1; } git fetch --depth 1 --no-tags https://github.com/dozokit/links "+refs/tags/$tag:refs/release" echo "$RELEASE_KEY" > "$RUNNER_TEMP/allowed_signers" if ! git -c gpg.ssh.allowedSignersFile="$RUNNER_TEMP/allowed_signers" verify-tag refs/release || [ "$(git cat-file tag refs/release | sed -n 's/^tag //p')" != "$tag" ]; then echo "Release $tag is not signed by Dozokit's release key, so it was not installed. Nothing changed."; exit 1 fi current=$(sed -n 's/^const VERSION = "\(.*\)";/\1/p' worker/api.ts) if [ -n "$current" ] && [ "$(printf '%s\n' "$current" "${tag#v}" | sort -V | tail -1)" != "${tag#v}" ]; then echo "You have $current, newer than the latest release $tag. Nothing changed."; exit 0 fi git checkout refs/release -- . ':!wrangler.jsonc' ':!.github' if git diff --cached --quiet; then echo "Already up to date."; exit 0; fi git config user.name "github-actions[bot]" git config user.email "41898283+github-actions[bot]@users.noreply.github.com" git commit -m "Update Dozokit Links to ${tag#v}" git push