Skip to content

Commit

Permalink
Merge pull request #4 from fac/use-release-gem-workflow
Browse files Browse the repository at this point in the history
Switch over to official release-gem
  • Loading branch information
dmorgan-fa authored Jul 10, 2024
2 parents b50fed7 + a815428 commit 333f7d0
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions .github/workflows/release_gem.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,28 @@
name: Build and Release Gem
on:
# This event will only trigger a workflow run if the workflow file is on the default branch.
# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_run
workflow_run:
workflows: ["Tests"]
types:
- completed
workflow_dispatch:

jobs:
release:
name: Release to GitHub Packages
name: Release to RubyGems.org
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/main' }}
permissions:
packages: 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@v4
- 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/main'
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/main'
uses: fac/ruby-gem-push-action@v2
with:
key: rubygems
pre-release: true
# Release
- name: Release to RubyGems.org
uses: rubygems/release-gem@v1

0 comments on commit 333f7d0

Please sign in to comment.