Release v2.1.0 #4
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: Release | |
run-name: Release ${{ inputs.version }} | |
permissions: | |
# Required for tag push and release creation | |
# https://docs.github.com/en/rest/overview/permissions-required-for-github-apps?apiVersion=2022-11-28#contents | |
contents: write | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
description: "Tagging version (ex: v1.0.1)" | |
required: true | |
isMajorVersion: | |
type: boolean | |
description: If true, it will update the major version of the tag. | |
default: true | |
isRelease: | |
type: boolean | |
description: If true, it will create a GitHub Release. | |
default: true | |
jobs: | |
tagging-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
git tag ${{ inputs.version }} | |
git push --tags origin ${{ inputs.version }} | |
tagging-major-version-only: | |
# Make it available by specifying a major version, such as `renovate-dry-run-action@v1`. | |
runs-on: ubuntu-latest | |
if: ${{ inputs.isMajorVersion }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
MAJOR_VERSION=$(echo ${{ inputs.version }} | awk -F'.' '{print $1}') | |
echo $MAJOR_VERSION | |
git tag --force $MAJOR_VERSION | |
git push --force --tags origin $MAJOR_VERSION | |
release: | |
runs-on: ubuntu-latest | |
if: ${{ inputs.isRelease }} | |
needs: tagging-version | |
env: | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
gh release create ${{ inputs.version }} --generate-notes --draft |