55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
# 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:
|
|
# 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)"
|