Skip to content

Commit

Permalink
Merge pull request #46 from fac/update-release-flow
Browse files Browse the repository at this point in the history
Update release mechanism to use RubyGem Trusted OIDC flow
  • Loading branch information
DuncSmith authored Jul 10, 2024
2 parents 878766b + 31e0eab commit 1de8bbf
Showing 1 changed file with 19 additions and 41 deletions.
60 changes: 19 additions & 41 deletions .github/workflows/freeagent-gem.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,36 @@
# Build, test and push gems to the FreeAgent registry.
# https://github.com/orgs/fac/packages?ecosystem=rubygems
# https://www.notion.so/freeagent/Internal-gems-5c8098501fcc48e4921be31aa9b4d495
name: FreeAgent Gem

on:
push:
branches: [master]
pull_request:

jobs:
# Install the bundle and run the gems test suite.
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1 # .ruby-version
with:
bundler-cache: true # bundle install
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Test
run: bundle exec rake
- name: Test
run: bundle exec rake

# Builds that pass testing above, will trigger a build and push of the new
# gem version to the registry. If the version.rb has not been bumped since
# the last release, the push will no-op.
release:
needs: tests
needs: tests
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest

permissions:
id-token: write
contents: write

steps:
- uses: fac/ruby-gem-setup-credentials-action@v2
with:
user: ""
key: rubygems
token: ${{ secrets.FAC_RUBYGEMS_KEY }}

# Build the gem package
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec rake build

# Release production gem version from default branch
- name: Release
if: github.ref == 'refs/heads/master'
uses: fac/ruby-gem-push-action@v2
with:
key: rubygems

# PR branch builds will release pre-release gems
- name: Pre-Release
if: github.ref != 'refs/heads/master'
uses: fac/ruby-gem-push-action@v2
with:
key: rubygems
pre-release: true
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- uses: rubygems/release-gem@v1

0 comments on commit 1de8bbf

Please sign in to comment.