Skip to content
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

Update release mechanism to use RubyGem Trusted OIDC flow #46

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading