Release Action #10
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 Action | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: 'Ref' | |
required: true | |
default: 'main' | |
version: | |
description: 'Version' | |
required: true | |
jobs: | |
release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.ref }} | |
- name: Create Release | |
uses: actions/github-script@v7 | |
env: | |
INPUT_REF: ${{ inputs.ref }} | |
INPUT_VERSION: ${{ inputs.version }} | |
with: | |
script: | | |
await github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: 'v' + core.getInput('version'), | |
target_commitish: core.getInput('ref'), | |
}) | |
- name: Move Major Version Tag | |
env: | |
INPUT_VERSION: ${{ inputs.version }} | |
run: | | |
# move the major version tag e.g. v1 | |
MAJOR_INPUT_VERSION="${INPUT_VERSION%%.*}" | |
MAJOR_VERSION_TAG="v${MAJOR_INPUT_VERSION}" | |
git tag --force "${MAJOR_VERSION_TAG}" | |
git push --force origin "${MAJOR_VERSION_TAG}" |