Merge pull request #7 from StuBehan/chore/oss-readiness #7
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 Merge | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| tag: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Read version from Info.plist | |
| id: version | |
| run: | | |
| VERSION=$(grep -A1 'CFBundleShortVersionString' notifier/Info.plist \ | |
| | tail -1 | sed 's/.*<string>\(.*\)<\/string>.*/\1/' | tr -d '[:space:]') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check if tag already exists | |
| id: tag_check | |
| run: | | |
| if git ls-remote --tags origin "refs/tags/v${{ steps.version.outputs.version }}" | grep -q .; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create and push tag | |
| if: steps.tag_check.outputs.exists == 'false' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag "v${{ steps.version.outputs.version }}" | |
| git push origin "v${{ steps.version.outputs.version }}" |