Generate release target for new-release/main/Smdn.Text.Ondulish.Dictionaries-4.0.2 #8
Workflow file for this run
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
# SPDX-License-Identifier: MIT | |
# SPDX-FileCopyrightText: "2022 smdn <[email protected]>" | |
name: Generate release target | |
run-name: Generate release target for ${{ inputs.release_target_tag_name || github.ref_name }} | |
on: | |
push: | |
tags: | |
- new-release/*/* | |
workflow_dispatch: | |
inputs: | |
release_target_tag_name: | |
description: "The tag name of release target." | |
required: true | |
type: string | |
dry_run: | |
description: "If true, performs a trial run." | |
required: false | |
type: boolean | |
default: false | |
jobs: | |
determine-release-target: | |
runs-on: ubuntu-latest | |
outputs: | |
tag_name: ${{ steps.release-target.outputs.tag_name }} | |
dry_run: ${{ steps.release-target.outputs.dry_run }} | |
steps: | |
- name: Determine the release target tag | |
id: release-target | |
run: | | |
# If workflow is trigged by workflow_dispatch, the value of github.ref_name contains branch ref which workflow runs from. | |
# Due to the reason of above, github.event.inputs.release_target_tag_name must be tested before testing github.ref_name. | |
if [[ -n '${{ github.event.inputs.release_target_tag_name }}' ]]; then | |
# use dispatched tag name | |
echo 'tag_name=${{ github.event.inputs.release_target_tag_name }}' >> $GITHUB_OUTPUT | |
if [ '${{ github.event.inputs.dry_run }}' = 'true' ]; then | |
echo 'dry_run=true' >> $GITHUB_OUTPUT | |
else | |
echo 'dry_run=false' >> $GITHUB_OUTPUT | |
fi | |
exit 0 | |
fi | |
if [[ -n '${{ github.ref_name }}' ]]; then | |
# use pushed tag name | |
echo 'tag_name=${{ github.ref_name }}' >> $GITHUB_OUTPUT | |
echo 'dry_run=false' >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
echo "::error::release target tag could not be determined." | |
exit 1 | |
run-generate-release-target: | |
uses: smdn/Smdn.Fundamentals/.github/workflows/generate-release-target.yml@workflows/release-target-v1.5.8 | |
needs: determine-release-target | |
if: startsWith(needs.determine-release-target.outputs.tag_name, 'new-release/') | |
with: | |
release_target_tag_name: ${{ needs.determine-release-target.outputs.tag_name }} | |
release_target_tag_prefix: 'new-release/' | |
release_target_pr_label: 'release-target' | |
release_tag_prefix: 'releases/' | |
workflow_runs_on: 'ubuntu-22.04' | |
dry_run: ${{ fromJSON(needs.determine-release-target.outputs.dry_run) }} | |
secrets: | |
token_repo: ${{ secrets.PUBLISH_NEW_RELEASE }} | |
token_pullrequest: ${{ secrets.PUBLISH_NEW_RELEASE }} | |
token_gist: ${{ secrets.PUBLISH_NEW_RELEASE }} |