.github/workflows/update-tags.yaml #1
Workflow file for this run
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
on: | |
release: | |
types: [published] | |
jobs: | |
github-example-tags: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Configure Git | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Create major/major.minor tags | |
run: | | |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME" | |
MAJOR_VERSION=$(echo $GITHUB_REF_NAME | cut -d'.' -f1 | tr -d 'v') | |
MINOR_VERSION=$(echo $GITHUB_REF_NAME | cut -d'.' -f2) | |
PATCH_VERSION=$(echo $GITHUB_REF_NAME | cut -d'.' -f3) | |
git checkout "$GITHUB_REF_NAME" | |
git tag -af "v$MAJOR_VERSION" -m "$GITHUB_REF_NAME" | |
git checkout "$GITHUB_REF_NAME" | |
git tag -af "v$MAJOR_VERSION.$MINOR_VERSION" -m "$GITHUB_REF_NAME" | |
- name: Push tags | |
run: | | |
git push origin HEAD:main --follow-tags |