Push gem #13
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: Push gem | |
| "on": | |
| workflow_run: | |
| workflows: ["Ruby"] | |
| branches: [main] | |
| types: | |
| - completed | |
| jobs: | |
| push: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| submodules: recursive | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| ruby-version: ruby | |
| - name: Check if version already exists | |
| id: version-check | |
| run: | | |
| VERSION=$(cat VERSION) | |
| if gem list -r sdk-reforge | grep -q "sdk-reforge ($VERSION)"; then | |
| echo "version-exists=true" >> $GITHUB_OUTPUT | |
| echo "Version $VERSION already exists on RubyGems, skipping publish" | |
| else | |
| echo "version-exists=false" >> $GITHUB_OUTPUT | |
| echo "Version $VERSION not found, proceeding with publish" | |
| fi | |
| - name: Release gem | |
| if: steps.version-check.outputs.version-exists == 'false' | |
| uses: rubygems/release-gem@v1 |