Update tag.yml #3
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: Add and Read Tag | |
on: [push] | |
jobs: | |
add-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Add tag to commit | |
run: | | |
TAG_NAME="v1.0.$(date +%Y%m%d%H%M%S)" | |
git tag $TAG_NAME | |
git push origin $TAG_NAME | |
read-tag: | |
runs-on: ubuntu-latest | |
needs: add-tag | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Get existing version tag | |
id: get-existing-tag | |
run: | | |
echo "EXISTING=$(git tag --points-at HEAD | head -1)" >> $GITHUB_OUTPUT | |
- name: Output tag | |
run: echo "Tag:${{ steps.get-existing-tag.outputs.EXISTING }}" |