# Cuts a release from main: [Unreleased] in CHANGELOG.md becomes the version's # section, then the commit and its tag are pushed together. The tag push starts # deploy.yml, which publishes the release to `next` for the canary. name: release on: workflow_dispatch: inputs: release: description: "major, minor, patch, or an exact version such as 1.57.0" required: true default: minor concurrency: group: release permissions: contents: write jobs: cut: runs-on: self-hosted steps: # A mirror carries its own Actions secrets. An empty token checks out # fine and fails at the push instead, which reads as a broken release. - name: Check DEPLOY_TOKEN is configured env: DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} run: | if [ -z "$DEPLOY_TOKEN" ]; then echo "::error::DEPLOY_TOKEN is not set for this repository, so the release cannot push its commit and tag. Set the secret here, or dispatch the release from the Gitea primary." exit 1 fi # DEPLOY_TOKEN rather than the job token: a push made with the job token # doesn't start workflows, and the tag push must start deploy.yml. - name: Checkout uses: actions/checkout@v4 with: ref: main fetch-depth: 0 token: ${{ secrets.DEPLOY_TOKEN }} - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: go.mod # The self-hosted runner keeps the Go caches on disk between jobs, and # archiving them for the Actions cache takes minutes. cache: false - name: Install Task run: go install github.com/go-task/task/v3/cmd/task@v3.48.0 - name: Cut the release env: RELEASE: ${{ inputs.release }} run: | git config user.name "Sam Catlow" git config user.email "sam@catlow.tech" task release RELEASE="$RELEASE" # Atomic: a commit without its tag would build images stamped dev. - name: Push the release run: git push --atomic origin main "$(git describe --exact-match --match 'v*' HEAD)"