Skip to content

Print tag

Print tag #85

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@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
run: |
import sys
print("hello")
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)
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 }}"