Skip to content

Instantly share code, notes, and snippets.

@parkerproject
Created August 22, 2022 16:25
Show Gist options
  • Save parkerproject/2a9e18a1407c82847f1c994c5d716f94 to your computer and use it in GitHub Desktop.
Save parkerproject/2a9e18a1407c82847f1c994c5d716f94 to your computer and use it in GitHub Desktop.
# https://stackoverflow.com/questions/69343233/github-action-increment-version-on-push-to-main
name: Version Increment
on:
push:
branches:
- main
jobs:
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- run: git config user.name "$GITHUB_ACTOR"
- run: npm version minor -m "v%s"
- run: VERSION=$(node -p "require('./package.json').version")
- run: git tag ${VERSION}
- run: git push "https://$GITHUB_ACTOR:${{ secrets.ACCESS_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --follow-tags
- run: git push "https://$GITHUB_ACTOR:${{ secrets.ACCESS_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment