From 2a2c64c651ac500d199fedd371d442b755d85a18 Mon Sep 17 00:00:00 2001 From: Grug Date: Fri, 23 Oct 2026 09:09:26 +0800 Subject: [PATCH] Deploy the site from a release branch moved on each published release (#207) Co-authored-by: boratatouille <178141691+boratatouille@users.noreply.github.com> --- .github/workflows/deploy-site.yml | 33 +++++++++++++++++++++++++++++++ CONTRIBUTING.md | 12 +++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/deploy-site.yml diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml new file mode 100644 index 0000000..71e373c --- /dev/null +++ b/.github/workflows/deploy-site.yml @@ -0,0 +1,33 @@ +name: Deploy site on release + +# Cloudflare Workers Builds deploys the site from the `release` branch. +# Publishing a GitHub release moves `release` to the released tag. + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: Tag to deploy (for example 1.1.0) + required: true + type: string + +permissions: + contents: write + +jobs: + move-release-branch: + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' || github.event.release.prerelease == false + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Point release branch at tag + env: + TAG: ${{ inputs.tag || github.event.release.tag_name }} + run: | + SHA=$(git rev-parse "refs/tags/$TAG^{commit}") + git push --force origin "$SHA:refs/heads/release" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5112cf..5f7b215 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,3 +28,15 @@ Workers Builds settings: - Enable builds for non-production branches for branch preview URLs. Thanks for helping! + +## Releases and the docs site + +The site at basecoatui.com deploys from the `release` branch, not `main`, so the docs always match the version on npm. Nobody commits to `release` directly. + +To release: + +1. Bump the version in `package.json`, commit, tag (for example `1.1.0`) and push. +2. Run `npm publish`. +3. Publish a GitHub release for the tag, for example `gh release create 1.1.0 --generate-notes`. + +Publishing the release runs `.github/workflows/deploy-site.yml`, which points `release` at the tag. Cloudflare then builds and deploys the site. To redeploy or roll back, run that workflow manually with the tag you want live.