surrealpatch/.github/workflows/release.yml

53 lines
1.6 KiB
YAML
Raw Normal View History

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' }})"
2022-09-22 13:56:27 +00:00
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"
2022-09-22 13:56:27 +00:00
push:
tags:
- "v*.*.*"
defaults:
run:
shell: bash
2022-09-22 13:56:27 +00:00
jobs:
checks:
name: Pre-release checks
runs-on: ubuntu-latest
env:
GIT_REF: ${{ inputs.git-ref || github.ref_name }}
2022-09-22 13:56:27 +00:00
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