Bump actions/checkout from 4 to 5 #13
Workflow file for this run
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: Tag and Release Gem | |
| env: | |
| GEM_NAME: query_packwerk | |
| GEM_CLASS_NAME: QueryPackwerk | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| actions: read | |
| jobs: | |
| tag: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.2 | |
| - name: Determine release type | |
| id: version | |
| run: | | |
| if [[ "${{ github.event.pull_request.labels[*] }}" == *"major"* ]]; then | |
| echo "bump=major" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.event.pull_request.labels[*] }}" == *"minor"* ]]; then | |
| echo "bump=minor" >> $GITHUB_OUTPUT | |
| else | |
| echo "bump=patch" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Bump version | |
| run: | | |
| gem install bump | |
| bump ${{ steps.version.outputs.bump }} | |
| - name: Commit and tag version bump | |
| run: | | |
| # Attribute commits to the last committer on HEAD | |
| git config --global user.email "$(git log -1 --pretty=format:'%ae')" | |
| git config --global user.name "$(git log -1 --pretty=format:'%an')" | |
| git remote set-url origin "https://x-access-token:${{ github.token }}@github.com/$GITHUB_REPOSITORY" | |
| VERSION=$(ruby -e "require './lib/${{ env.GEM_NAME }}/version'; puts ${{ env.GEM_CLASS_NAME }}::VERSION") | |
| git commit -am "Bump version to $VERSION" | |
| git tag "v$VERSION" | |
| git push origin main "v$VERSION" | |
| release: | |
| if: github.repository == 'rubyatscale/query_packwerk' | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1.229.0 | |
| with: | |
| bundler-cache: true | |
| ruby-version: ruby | |
| # Release | |
| - uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1 |