🏡 index : quine-global/quine-linux.git

name: Release

# Starts a release: works out the next version from the newest v* tag, tags
# main's commit with it, and pushes the tag. That tag push starts iso.yml,
# which builds both architectures, uploads their files to
# <bucket>/releases/<tag>/ and makes the Forgejo release.
#
# Run it from Actions → Release → Run workflow (for a beta, Beta release
# does the same in one click). The work is .forgejo/release-tag.sh. `bump`:
# - prerelease: the next prerelease. v0.1.0-alpha.2 → v0.1.0-alpha.3. With
#   another `pre`: v0.1.0-alpha.2 → v0.1.0-beta.1. After a full release:
#   v0.1.0 → v0.1.1-alpha.1.
# - release: the full release of the current prerelease, v0.1.0-rc.2 → v0.1.0.
# - patch, minor, major: v0.1.0 → v0.1.1, v0.2.0, v1.0.0, or, with `pre`
#   other than none, v0.1.1-alpha.1 and so on. From a prerelease, patch
#   moves past it too: v0.1.0-alpha.2 → v0.1.1.
# `version` (e.g. 1.0.0, without the v) skips all that.
# `dry_run` says what it would tag, and tags nothing. It tags main's newest
# commit not marked [skip ci]: Forgejo wouldn't build a tag on one.
#
# Secret: RELEASE_TOKEN, a Forgejo token with write:repository on this repo,
# for the push. Not the automatic token: a tag pushed with that doesn't
# start iso.yml.

on:
  workflow_dispatch:
    inputs:
      bump:
        description: What to release
        type: choice
        options: [prerelease, release, patch, minor, major]
        default: prerelease
      pre:
        description: Prerelease label (prerelease, patch, minor and major)
        type: choice
        options: [alpha, beta, rc, none]
        default: alpha
      version:
        description: Exact version instead (e.g. 1.0.0 or 1.0.0-rc.1; no v)
        type: string
        default: ''
      dry_run:
        description: Only say which tag it would make
        type: boolean
        default: false

concurrency:
  group: release
  cancel-in-progress: false

jobs:
  tag:
    runs-on: runner-x86-linux
    steps:
      - uses: https://forge.in.quineglobal.com/quine-global/mirror-actions-checkout@v4
        with:
          ref: main
          fetch-depth: 0
          token: ${{ secrets.RELEASE_TOKEN || github.token }}

      - name: Tag the next release and push the tag
        env:
          BUMP: ${{ inputs.bump }}
          PRE: ${{ inputs.pre }}
          VERSION: ${{ inputs.version }}
          DRY_RUN: ${{ inputs.dry_run }}
          HAS_TOKEN: ${{ secrets.RELEASE_TOKEN != '' }}
        run: .forgejo/release-tag.sh