Create tag #1
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
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Release tag' | |
required: true | |
jobs: | |
check_and_create_tag: | |
runs-on: ubuntu-latest | |
name: Check and create tag | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setting up Git | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email '[email protected]' | |
- name: Check if tag exists | |
id: tagcheck | |
run: | | |
if git rev-parse "refs/tags/${{ github.event.inputs.tag }}" >/dev/null 2>&1; then | |
echo "Tag ${{ github.event.inputs.tag }} already exists" | |
echo "TAG_EXISTS=true" >> $GITHUB_ENV | |
else | |
echo "${{ github.event.inputs.tag }} does not exist" | |
echo "TAG_EXISTS=false" >> $GITHUB_ENV | |
- name: Create and push tag | |
if: env.TAG_EXISTS == 'false' | |
run: | | |
git tag ${{ github.event.inputs.tag }} | |
git push origin ${{ github.event.inputs.tag }} |