Repository navigation
fix: publish gem to RubyGems on release via trusted publishing #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a8be7dd
fix: keep lib/flagsmith/version.rb in sync with releases
khvn26 046488c
ci: publish gem to RubyGems via trusted publishing
khvn26 59b18a9
ci: only allow manual gem publishing from main or a release tag
khvn26 7c8aaa0
ci: only publish gems from release tags
khvn26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,62 @@ | ||
| # This workflow will build the gem from gemspec and publish | ||
| # Builds the gem and publishes it to RubyGems.org using trusted publishing (OIDC). | ||
| # | ||
| # Runs automatically when release-please publishes a GitHub release. It can also be | ||
| # triggered manually from a release tag, e.g. to retry a failed publish. | ||
|
|
||
| name: Push Ruby Gem | ||
|
|
||
| # TODO: this workflow doesn't work, needs fixing but for now, I've just changed it so | ||
| # it will only run if triggered manually. Instructions for releasing manually are here: | ||
| # https://www.notion.so/flagsmith/SDKs-Deployment-Instructions-c1190a22238a45af9a51c7f0fea27f99 | ||
| on: workflow_dispatch | ||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| release: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} | ||
| # Only ever publish tagged code: release events run on the release tag, and manual runs must pick one too. | ||
| if: github.ref_type == 'tag' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| fetch-depth: 0 # need all the commits | ||
| - uses: ruby/setup-ruby@v1 | ||
| persist-credentials: false | ||
|
|
||
| - uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 | ||
| with: | ||
| ruby-version: .ruby-version | ||
| bundler-cache: true | ||
| - name: Buld and Push to rubygems.org | ||
| run: | | ||
| bundle install | ||
| gem build flagsmith.gemspec | ||
| bundle exec rake release[remote] | ||
|
matthewelwell marked this conversation as resolved.
Resolved
|
||
|
|
||
| - name: Build gem | ||
| run: gem build flagsmith.gemspec | ||
|
|
||
| - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | ||
| with: | ||
| name: gem | ||
| path: flagsmith-*.gem | ||
| if-no-files-found: error | ||
|
|
||
| publish: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| environment: rubygems | ||
|
|
||
| permissions: | ||
| id-token: write # to authenticate with RubyGems.org via trusted publishing | ||
|
|
||
| steps: | ||
| - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | ||
| with: | ||
| name: gem | ||
|
|
||
| - uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0 | ||
| with: | ||
| ruby-version: ruby | ||
|
|
||
| - uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0 | ||
|
|
||
| - name: Push gem to RubyGems.org | ||
| run: gem push flagsmith-*.gem | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Flagsmith | ||
| VERSION = '4.3.0' | ||
| VERSION = '5.4.0' | ||
| end |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.