surrealpatch/.github/workflows/release.yml

52 lines
1.6 KiB
YAML

name: Tag release
run-name: "Tag release '${{ inputs.git-ref || github.ref_name }}' (publish: ${{ inputs.publish || github.event_name == 'push' }}, latest: ${{ inputs.latest || github.event_name == 'schedule' }})"
on:
workflow_dispatch:
inputs:
git-ref:
required: true
type: string
description: "The github ref of this release. If you are publishing it, use a tag (i.e. v1.0.0)."
default: main
latest:
required: false
type: boolean
default: false
description: "Consider this release as the latest one and update the Docker image tag and the binary pointer for the installers"
publish:
required: false
type: boolean
default: false
description: "Publish the release"
push:
tags:
- "v*.*.*"
defaults:
run:
shell: bash
jobs:
checks:
name: Pre-release checks
runs-on: ubuntu-latest
env:
GIT_REF: ${{ inputs.git-ref || github.ref_name }}
steps:
- name: Verify that the provided git_ref is a tag when 'publish' is true
if: ${{ inputs.publish || github.event_name == 'push' }}
run: |
git tag -l | grep -w $GIT_REF || (echo "The provided git_ref '$GIT_REF' is not a tag" && exit 1)
release:
name: Prepare release
needs: [checks]
uses: ./.github/workflows/reusable_publish_version.yml
with:
git-ref: ${{ inputs.git-ref || github.ref_name }}
latest: ${{ inputs.latest || github.event_name == 'push' }}
publish: ${{ inputs.publish || github.event_name == 'push' }}
create-release: ${{ inputs.publish || github.event_name == 'push' }}
secrets: inherit