Skip to content

Commit

Permalink
Publish to rubygems from workdir (#3)
Browse files Browse the repository at this point in the history
* Publish to rubygems from workdir

* Switch from defaults to env

* Deploy for testing purpose

* Only release when version file changes

* Set WORKDIR from PROJECT_DIR

* Test release rubocop-cobra

* Only release tagged commits
  • Loading branch information
xjunior authored May 19, 2022
1 parent 3aef920 commit db7b670
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/rubocop-cobra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: rubocop-cobra
on:
push:

env:
PROJECT_DIR: rubocop-cobra

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -19,20 +22,24 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
working-directory: ./rubocop-cobra
working-directory: ${{ env.PROJECT_DIR }}
- name: Run the build script
working-directory: ./rubocop-cobra
working-directory: ${{ env.PROJECT_DIR }}
run: bundle exec rake

release:
needs: build
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- name: Release Gem
uses: cadwallion/publish-rubygems-action@master
if: contains(github.ref, 'refs/tags/v')
- id: version-changed
uses: tj-actions/changed-files@v20
with:
files: ${{ env.PROJECT_DIR }}/**/version.rb
- uses: xjunior/publish-rubygems-action@master
if: steps.version-changed.outputs.any_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
RUBYGEMS_API_KEY: ${{ secrets.rubygems_api_key }}
RELEASE_COMMAND: 'cd rubocop-cobra && rake release'
WORKDIR: ${{ env.PROJECT_DIR }}
19 changes: 13 additions & 6 deletions .github/workflows/rubocop-powerhome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: rubocop-powerhome
on:
push:

env:
PROJECT_DIR: rubocop-powerhome

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -19,20 +22,24 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
working-directory: ./rubocop-powerhome
working-directory: ${{ env.PROJECT_DIR }}
- name: Run the build script
working-directory: ./rubocop-powerhome
working-directory: ${{ env.PROJECT_DIR }}
run: bundle exec rake

release:
needs: build
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- name: Release Gem
uses: cadwallion/publish-rubygems-action@master
if: contains(github.ref, 'refs/tags/v')
- id: version-changed
uses: tj-actions/changed-files@v20
with:
files: ${{ env.PROJECT_DIR }}/**/version.rb
- uses: xjunior/publish-rubygems-action@master
if: steps.version-changed.outputs.any_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
RUBYGEMS_API_KEY: ${{ secrets.rubygems_api_key }}
RELEASE_COMMAND: 'cd rubocop-powerhome && rake release'
WORKDIR: ${{ env.PROJECT_DIR }}
2 changes: 1 addition & 1 deletion rubocop-cobra/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PATH
PATH
remote: .
specs:
rubocop-cobra (0.1.0)
rubocop-cobra (0.1.1)
rubocop
rubocop-powerhome

Expand Down
2 changes: 1 addition & 1 deletion rubocop-cobra/lib/rubocop/cobra/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module RuboCop
module Cobra
VERSION = "0.1.0"
VERSION = "0.1.1"
end
end

0 comments on commit db7b670

Please sign in to comment.