Skip to content

Commit 760552f

Browse files
committed
Introduce Github Action for release phase
Github Action will be trigger when user create Github release. It will run all checks on gem like tests and linter. At the end it will publish gem to Rubygems repository. It also includes updated README file with detail instructions.
1 parent 9ec6c16 commit 760552f

File tree

4 files changed

+44
-9
lines changed

4 files changed

+44
-9
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: release
2+
run-name: Publish and release new version
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Setup git user
15+
run: |
16+
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
17+
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
18+
19+
- uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: "3.1"
22+
bundler-cache: true
23+
24+
- run: bundle install
25+
- run: bundle exec rspec
26+
- run: bundle exec rubocop
27+
28+
- name: Build and publish gem
29+
run: bundle exec rake release[remote]
30+
env:
31+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ AllCops:
1313
- "bin/*"
1414
- "spec/examples/*"
1515
- "spec/spec_helper.rb"
16+
- "vendor/**/*"
1617

1718
Bundler/DuplicatedGem:
1819
Enabled: true

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ end
99
gemspec
1010

1111
group :development, :test do
12+
gem "gem-release"
1213
gem "pry"
1314
gem "rspec"
1415
gem "rubocop", require: false

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,15 @@ cd alchemist_theme
128128
129129
1. Implement your code changes.
130130
2. Bump the version in the code:
131-
1. Update the version in `lib/canvas/version.rb`.
132-
2. Commit these changes.
131+
1. bundle exec gem bump --version [minor|major|patch]
132+
2. Commit these changes.
133133
3. Push changes, wait for PR to be approved, then merge to `main`.
134-
4. Pull the latest from `main` and then run the following rake task locally:
135-
136-
```
137-
rake release[origin]
138-
```
139-
This will tag the gem, push the tag to github, build the gem, and push it to [rubygems.org](http://rubygems.org). You will need to have a RubyGem account and be added to the project.
140-
5. On major version changes, update the version lock in the [canvas-linter-action](https://github.com/easolhq/canvas-linter-action/blob/main/entrypoint.sh) repo.
134+
4. Pull the latest from `main` and then tag the latest version via git:
135+
```
136+
bundle exec gem tag
137+
```
138+
5. Push created tag which will trigger Github actions responsible for publishing
139+
new version of the gem to rubygems.org repository
140+
6. On major version changes, update the version lock in the
141+
[canvas-linter-action](https://github.com/easolhq/canvas-linter-action/blob/main/entrypoint.sh)
142+
repo.

0 commit comments

Comments
 (0)