Regenerate from OpenAPI 8798c65e97c3d2e2980d6a9f9c56d681aa66b2df (#43) #25
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 to RubyGems | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: release | |
| env: | |
| RUBYGEMS_OIDC_ROLE: ${{ vars.RUBYGEMS_OIDC_ROLE }} | |
| RUBYGEMS_API_TOKEN: ${{ secrets.RUBYGEMS_API_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.2" | |
| bundler-cache: true | |
| - name: Verify tag matches gem version | |
| run: | | |
| GEM_VERSION="$(ruby -e 'require "./lib/activitysmith/version"; puts ActivitySmith::VERSION')" | |
| if [ "${GITHUB_REF_TYPE}" = "tag" ]; then | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| if [ "$TAG_VERSION" != "$GEM_VERSION" ]; then | |
| echo "Tag version ($TAG_VERSION) does not match gem version ($GEM_VERSION)." | |
| exit 1 | |
| fi | |
| else | |
| echo "Non-tag ref '${GITHUB_REF_NAME}', publishing gem version ${GEM_VERSION}." | |
| fi | |
| - name: Configure RubyGems credentials (OIDC) | |
| if: ${{ env.RUBYGEMS_OIDC_ROLE != '' }} | |
| uses: rubygems/configure-rubygems-credentials@v1.0.0 | |
| with: | |
| role-to-assume: ${{ env.RUBYGEMS_OIDC_ROLE }} | |
| - name: Configure RubyGems credentials (API token) | |
| if: ${{ env.RUBYGEMS_OIDC_ROLE == '' && env.RUBYGEMS_API_TOKEN != '' }} | |
| uses: rubygems/configure-rubygems-credentials@v1.0.0 | |
| with: | |
| api-token: ${{ env.RUBYGEMS_API_TOKEN }} | |
| - name: Require publish credentials | |
| if: ${{ env.RUBYGEMS_OIDC_ROLE == '' && env.RUBYGEMS_API_TOKEN == '' }} | |
| run: | | |
| echo "Missing RubyGems credentials." | |
| echo "Set repository variable RUBYGEMS_OIDC_ROLE for OIDC, or secret RUBYGEMS_API_TOKEN." | |
| exit 1 | |
| - name: Build and publish gem | |
| run: | | |
| GEM_VERSION="$(ruby -e 'require "./lib/activitysmith/version"; puts ActivitySmith::VERSION')" | |
| gem build activitysmith.gemspec | |
| gem push "activitysmith-${GEM_VERSION}.gem" |