Skip to content

Print tag

Print tag #92

Workflow file for this run

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@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- 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
run: |
import sys
print("hello")
import subprocess
tag_name = "${{ steps.get_tag.outputs.old_tag_name }}"
print("Checking if tag '{}' exists...".format(tag_name))
command = ['git', 'tag', '-l', tag_name]
print("Executing command:", " ".join(command))
output = subprocess.check_output(command, stderr=subprocess.STDOUT)
print("Command output:", output.decode())
if output.strip():
print(f"Error: Tag '{tag_name}' already exists.", file=sys.stderr)
sys.exit(1)
else:
print(f"Tag '{tag_name}' does not exist.")
shell: python
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 }}"