File tree Expand file tree Collapse file tree 6 files changed +104
-12
lines changed Expand file tree Collapse file tree 6 files changed +104
-12
lines changed Original file line number Diff line number Diff line change 1+ FROM ruby:3
2+
3+ RUN gem install parse_gemspec-cli
4+
5+ COPY entrypoint.sh /entrypoint.sh
6+
7+ ARG SPECFILE
8+
9+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1+ name : Fetches .gemspec metadata
2+ description : Reads the .gemspec file in the repo and exposes metadata from it
3+
4+ inputs :
5+ spec-file :
6+ description : ' The path of the gem spec file'
7+ required : true
8+
9+ outputs :
10+ name :
11+ description : " The name of this Ruby gem"
12+ version :
13+ description : " The version of this Ruby gem"
14+ description :
15+ description : " The description of this Ruby gem"
16+ homepage :
17+ description : " The homepage of this Ruby gem"
18+ summary :
19+ description : " The summary of this Ruby gem"
20+
21+ runs :
22+ using : " docker"
23+ image : " Dockerfile"
24+ env :
25+ SPEC_FILE : ${{ inputs.spec-file }}
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ SPEC_DATA=$( parse-gemspec-cli $SPECFILE )
4+
5+ echo " ::set-output name=name::$( echo $SPEC_DATA | jq -r ' .name' ) "
6+ echo " ::set-output name=description::$( echo $SPEC_DATA | jq -r ' .description' ) "
7+ echo " ::set-output name=summary::$( echo $SPEC_DATA | jq -r ' .summary' ) "
8+ echo " ::set-output name=version::$( echo $SPEC_DATA | jq -r ' .version' ) "
9+ echo " ::set-output name=homepage::$( echo $SPEC_DATA | jq -r ' .homepage' ) "
Original file line number Diff line number Diff line change 1- name : Build Branch
1+ name : Build branch
2+ description : Builds the current branch if applicable
23
3- on : [push, pull_request]
4+ on :
5+ push :
6+ branches-ignore :
7+ - 1.x
8+ - main
9+ tags-ignore :
10+ - v1.x
11+ - v2.x
412
513jobs :
614 test :
7- if : ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/2.x' }}
815 runs-on : ubuntu-latest
916 strategy :
1017 matrix :
1118 ruby-version : ['2.6', '2.7', '3.0']
1219
1320 steps :
1421 - uses : actions/checkout@v2
15- - name : Set up Ruby
16- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
17- # change this to (see https://github.com/ruby/setup-ruby#versioning):
18- # uses: ruby/setup-ruby@v1
22+ - name : 💎 Set up Ruby
1923 uses : ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
2024 with :
2125 ruby-version : ${{ matrix.ruby-version }}
2226 bundler-cache : true
23- - name : Run tests
27+ - name : 🧪 Run tests
2428 run : bundle exec rake
Original file line number Diff line number Diff line change 1+ name : Build Tag
2+ description : Creates a new tag in case there is a new gemspec version specified.
3+
4+ on :
5+ push :
6+ branches :
7+ - main
8+ - 1.x
9+
10+ jobs :
11+ release :
12+ runs-on : ubuntu-latest
13+ if : # TODO new gem version detected: is current ruby version available as git tag already?
14+ steps :
15+ - uses : actions/checkout@v2
16+ - name : 💎 Extract gemspec info
17+ id : gemspec_fetch
18+ uses : ./.github/actions/gemspec-fetch
19+ 20+ id : tag-check
21+ with :
22+ tag : ' v${{ steps.gemspec_fetch.outputs.version }}'
23+ env :
24+ GITHUB_TOKEN : ${{ secrets.CUSTOM_GITHUB_TOKEN }}
25+ - name : 🔖Build tag
26+ if : ${{ !steps.checkTag.outputs.exists }}
27+ id : tag_version
28+ uses :
mathieudutour/[email protected] 29+ with :
30+ github_token : ${{ secrets.CUSTOM_GITHUB_TOKEN }}
31+ default_bump : false
32+ custom_tag : ${{ steps.gemspec_fetch.outputs.version }}
33+ tag_prefix : v
34+ - name : 📙 Github release
35+ if : ${{ !steps.checkTag.outputs.exists }}
36+ uses : ncipollo/release-action@v1
37+ with :
38+ tag : ${{ steps.tag_version.outputs.new_tag }}
39+ name : Release ${{ steps.tag_version.outputs.new_tag }}
40+ body : ${{ steps.tag_version.outputs.changelog }}
Original file line number Diff line number Diff line change 11name : Release Gem
2- on : [push]
2+ description : Releases a gem to rubygems.
3+
4+ on :
5+ push:tags
6+ branches :
7+ - v1.*
8+ - v2.*
39
410jobs :
511 release :
6- if : ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.x' }}
712 runs-on : ubuntu-latest
813 steps :
9- - uses : actions/checkout@v1
10- - name : Release gem
14+ - uses : actions/checkout@v2
15+ - name : 🚀 Release gem
1116 uses : dawidd6/action-publish-gem@v1
1217 with :
1318 github_token : ${{secrets.GH_CREDENTIALS}}
You can’t perform that action at this time.
0 commit comments