Print tag #81
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: Print tag | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: 'Tag name for the new release' | |
required: true | |
permissions: | |
contents: write | |
packages: write | |
pull-requests: write | |
jobs: | |
fetch-tag: | |
runs-on: ubuntu-latest | |
outputs: | |
old_tag: ${{ steps.get_tag.outputs.old_tag_name }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get latest tag | |
id: get_tag | |
run: | | |
echo "old_tag_name=$(git ls-remote --tags origin | awk -F'/' '{print $3}' | grep -v '{}' | sort -V | tail -n1)" >> $GITHUB_OUTPUT | |
- name: Use latest tag | |
run: echo "Latest tag is ${{ steps.get_tag.outputs.old_tag_name }}" | |
- name: Check if tag exists | |
id: check_tag | |
shell: python | |
run: | | |
# if git rev-parse "${{ github.event.inputs.tag_name }}" >/dev/null 2>&1; then | |
# echo "Error: Tag '${{ github.event.inputs.tag_name }}' already exists." | |
# exit 1 | |
# echo "::error ::tag exsistsn" | |
# fi | |
import subprocess | |
import sys | |
try: | |
# Check if the tag exists | |
subprocess.check_call(['git', 'rev-parse', '${{ github.ref }}']) | |
except subprocess.CalledProcessError: | |
# If the tag does not exist, print an error message and exit with code 1 | |
print("Error: Tag '${{ github.ref }}' already exists.", file=sys.stderr) | |
sys.exit(1) | |
continue-on-error: false | |
- name: print | |
id: print | |
run: | | |
echo "abcd" | |
update-params-env: | |
runs-on: ubuntu-latest | |
needs: fetch-tag | |
steps: | |
- name: print1 | |
id: print1 | |
run: | | |
echo " ${{ needs.fetch-tag.outputs.old_tag }}" | |