Skip to content

Commit

Permalink
github tagger
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodz committed Jan 2, 2024
1 parent 23b2ef1 commit 65dcd84
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/tagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@ name: tagger
on:
push:
branches:
- "main"
- main

jobs:
tagger:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Tag
- name: Create tag
id: tag
run: |
VERSION_FILE=".version"
VERSION_VALUE=$(cat $VERSION_FILE)
MAX_BRANCH_LENGTH=40
FIXED_BRANCH=$(echo ${GITHUB_REF:11:${MAX_BRANCH_LENGTH}} | sed 's/[^[:alnum:]]/-/g')
NEW_TAG=$(echo "$VERSION_VALUE-${FIXED_BRANCH}.$(date +%Y%m%d-%H%M%S)")
git tag ${NEW_TAG}
git push origin ${NEW_TAG} --force
echo "$NEW_TAG" >> $GITHUB_ENV
- name: Push tag
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git tag ${{ env.TAG }}
git push origin ${{ env.TAG }}

0 comments on commit 65dcd84

Please sign in to comment.