Created
          July 3, 2024 13:02 
        
      - 
      
- 
        Save Alex-Werner/0c81008cd41bb11e83a52fc8791a94f8 to your computer and use it in GitHub Desktop. 
    Have specific user commit after PR merge on branch
  
        
  
    
      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: Bump Version and Commit and tag | |
| on: | |
| push: | |
| branches: | |
| - release/testnet | |
| jobs: | |
| bump-version: | |
| if: "!contains(github.event.head_commit.message, 'chore(release):')" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PAT_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '21' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Configure git user | |
| run: | | |
| git config user.name "RepositoryCI" | |
| git config user.email "[email protected]" | |
| - name: Stage changes | |
| run: | | |
| git add . | |
| - name: Bump version without tag | |
| id: bump_version | |
| run: | | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| echo "Current version: $CURRENT_VERSION" | |
| NEW_VERSION=$(npm version patch --no-git-tag-version) | |
| echo "New version: $NEW_VERSION" | |
| git commit -am "chore(release): $NEW_VERSION" | |
| - name: Amend the commit to include all changes | |
| run: | | |
| git add . | |
| git commit --amend --no-edit | |
| - name: Push changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| run: | | |
| git pull --rebase | |
| git push origin HEAD:release/testnet --force-with-lease | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment