Merge pull request #156 from aryaveer0710/github_workflows #1
This file contains hidden or 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: Auto Tag on Version Change | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| tag: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Read version and create tag if new | |
| run: | | |
| VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}') | |
| TAG="v$VERSION" | |
| if git ls-remote --tags origin "$TAG" | grep -q "$TAG"; then | |
| echo "Tag $TAG already exists — skipping." | |
| else | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git tag "$TAG" | |
| git push origin "$TAG" | |
| echo "Tagged and pushed $TAG" | |
| fi |