Skip to content

new action

new action #1

Workflow file for this run

name: Auto Tag Release

Check failure on line 1 in .github/workflows/auto-tag.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/auto-tag.yaml

Invalid workflow file

(Line: 40, Col: 9): There's not enough info to determine what you meant. Add one of these properties: run, shell, uses, with, working-directory
on:
push:
branches:
- main
- auto-tag-gh-actions
env:
TAG_PREFIX: "TEST@"
jobs:
tag-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if tag exists
id: check_tag
run: |
VERSION=$(jq -r '.version' package.json)
TAG_NAME="${{ env.TAG_PREFIX }}${VERSION}"
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
if git ls-remote --tags origin | grep -q "refs/tags/${TAG_NAME}"; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Tag ${TAG_NAME} already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Tag ${TAG_NAME} does not exist"
fi
- name: Create and push tag
if: steps.check_tag.outputs.exists == 'false'
- name: Setup GH user
run: git config user.name ${{ secrets.GH_USER }}
- name: Setup GH email
run: git config user.email ${{ secrets.GH_EMAIL }}
- name: Generate tag
run: |
TAG_NAME="${{ steps.check_tag.outputs.tag_name }}"
git tag "${TAG_NAME}"
- name: Push latest tag
run: |
git push origin "${TAG_NAME}"
echo "Successfully created and pushed tag: ${TAG_NAME}"