56 lines
1.4 KiB
YAML
56 lines
1.4 KiB
YAML
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:
|
|
- 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 tag. Set the secret here, or dispatch the release from the Gitea primary."
|
|
exit 1
|
|
fi
|
|
|
|
- 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
|
|
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"
|
|
|
|
- name: Push the release
|
|
run: git push origin "$(git describe --exact-match --match 'v*' HEAD)"
|