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

Switch over to official release-gem #4

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
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