Skip to content

Commit

Permalink
Merge pull request #399 from procore-oss/jm-release-workflow-simplify
Browse files Browse the repository at this point in the history
chore: simplify release GitHub Action
  • Loading branch information
jmeridth authored Mar 12, 2024
2 parents 5fbd54f + d8d6832 commit 35524f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,41 @@ on:
workflow_run:
workflows: [Test]
types: [completed]
branches: [master, main]
branches: [main]
workflow_dispatch: # allow manual deployment through GitHub Action UI
jobs:
release:
version-check:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
outputs:
changed: ${{ steps.check.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
- name: Version file changed
id: version-file-changed
- name: Check if version has been updated
id: check
uses: tj-actions/changed-files@v42
with:
files: lib/blueprinter/version.rb
release:
runs-on: ubuntu-latest
needs: version-check
if: ${{ github.event_name == 'workflow_dispatch' || needs.version-check.outputs.changed == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
if: ${{ github.event_name == 'workflow_dispatch' || steps.version-file-changed.outputs.any_changed == 'true' }}
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Installing dependencies
if: ${{ github.event_name == 'workflow_dispatch' || steps.version-file-changed.outputs.any_changed == 'true' }}
run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle
- name: Build gem file
if: ${{ github.event_name == 'workflow_dispatch' || steps.version-file-changed.outputs.any_changed == 'true' }}
run: bundle exec rake build
- uses: fac/ruby-gem-setup-credentials-action@v2
if: ${{ github.event_name == 'workflow_dispatch' || steps.version-file-changed.outputs.any_changed == 'true' }}
with:
user: ""
key: rubygems
token: ${{secrets.RUBY_GEMS_API_KEY}}
- uses: fac/ruby-gem-push-action@v2
if: ${{ github.event_name == 'workflow_dispatch' || steps.version-file-changed.outputs.any_changed == 'true' }}
with:
key: rubygems
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Test
on:
push:
branches: [master, main]
branches: [main]
pull_request:
branches: [master, main]
branches: [main]
permissions:
contents: read
jobs:
Expand Down

0 comments on commit 35524f0

Please sign in to comment.