surrealpatch/.github/workflows/release.yml
Rushmore Mushambi 5547ce3056
Add beta release workflow (#3070)
Co-authored-by: Salvador Girones Gil <salvadorgirones@gmail.com>
2023-12-06 14:46:23 +00:00

61 lines
2 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
outputs:
is-beta: ${{ steps.outputs.outputs.is-beta }}
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' }}
id: outputs
run: |
set -x
git tag -l | grep -w $GIT_REF || (echo "The provided git_ref '$GIT_REF' is not a tag" && exit 1)
if [[ $GIT_REF == *"-beta"* ]]; then
echo "is-beta=true" >> $GITHUB_OUTPUT
else
echo "is-beta=false" >> $GITHUB_OUTPUT
fi
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' && needs.checks.outputs.is-beta == 'false') }}
publish: ${{ inputs.publish || github.event_name == 'push' }}
create-release: ${{ inputs.publish || github.event_name == 'push' }}
secrets: inherit