Release v4.0.0 #1
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: Publish Release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - main | |
| jobs: | |
| publish: | |
| # Only run if PR was merged and branch starts with "release/v" | |
| if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Generate token | |
| id: generate-token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ vars.ALCHEMY_BOT_APP_ID }} | |
| private-key: ${{ secrets.ALCHEMY_BOT_APP_PRIVATE_KEY }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| - name: Extract version from branch name | |
| id: version | |
| run: | | |
| VERSION=$(echo "${{ github.event.pull_request.head.ref }}" | sed 's/release\/v//') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Extracted version: $VERSION" | |
| - name: Configure git | |
| run: | | |
| git config user.name "alchemycms-bot" | |
| git config user.email "alchemycms-bot@users.noreply.github.com" | |
| - name: Create and push tag | |
| run: | | |
| git tag "v${{ steps.version.outputs.version }}" | |
| git push origin "v${{ steps.version.outputs.version }}" | |
| - name: Build gem | |
| run: gem build alchemy_cloudinary.gemspec | |
| - name: Publish to RubyGems | |
| run: gem push alchemy_cloudinary-*.gem | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| generate_release_notes: true | |
| files: alchemy_cloudinary-*.gem | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} |