-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from fac/use-release-gem-workflow
Switch over to official release-gem
- Loading branch information
Showing
1 changed file
with
7 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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,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 |