Experiment with the tag/version format #6
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: Automated CalVer Tagging | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Tag | |
id: create_tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
VERSION=v$(date +'%Y.%-m.%-d')+$(git rev-parse --short HEAD) | |
# Store the tag name in an environment variable for later use/steps | |
echo "TAG_NAME=$VERSION" >> $GITHUB_ENV | |
git tag -a "$VERSION" -m "Release $VERSION" | |
git push origin "$VERSION" --tags |