Publish a Release #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish a Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version tag to use in the form of x.x' | |
required: true | |
type: string | |
prerelease: | |
description: 'Check if this is to publish a pre-release.' | |
required: true | |
type: boolean | |
jobs: | |
make-tag-string: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.tag-string.outputs.tag }} | |
steps: | |
- name: Create tag | |
run: | | |
[ ${{ inputs.prerelease }} = false ] && echo "tag=v${{ inputs.version }}" >> $GITHUB_OUTPUT || \ | |
echo "tag=v${{ inputs.version }}-$GITHUB_RUN_NUMBER-prerelease" >> $GITHUB_OUTPUT | |
id: tag-string | |
validate-no-tag: | |
runs-on: ubuntu-latest | |
needs: [make-tag-string] | |
steps: | |
- name: Fetch Code | |
continue-on-error: true | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 | |
with: | |
ref: refs/tags/${{ needs.make-tag-string.outputs.tag }} | |
- name: Fail if tag ${{ needs.make-tag-string.outputs.tag }} exists | |
run: | | |
[[ $(git describe --tags) == ${{ needs.make-tag-string.outputs.tag }} ]] && exit 1 || : | |
invoke-build-for-publish: | |
uses: ./.github/workflows/invoke-build.yml | |
with: | |
tag: ${{ needs.make-tag-string.outputs.tag }} | |
prerelease: ${{ inputs.prerelease }} | |
secrets: | |
PACKAGE_USER: ${{ secrets.PACKAGE_USER }} | |
PACKAGE_PAT: ${{ secrets.PACKAGE_PAT }} | |
needs: [make-tag-string, validate-no-tag] | |