File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed
Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ name : release
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - main
8+ paths :
9+ - lib/version.rb
10+
11+ permissions :
12+ contents : write
13+ packages : write
14+
15+ jobs :
16+ release :
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : checkout
21+ uses : actions/checkout@v4
22+
23+ - uses : ruby/setup-ruby@f2f42b7848feff522ffa488a5236ba0a73bccbdd
24+ with :
25+ bundler-cache : true
26+
27+ - name : lint
28+ run : bundle exec rubocop -c .rubocop.yml lib/ test/
29+
30+ - name : test
31+ run : bundle exec rake
32+
33+ - name : set GEM_NAME from gemspec
34+ run : echo "GEM_NAME=$(ls | grep gemspec | cut -d. -f1)" >> $GITHUB_ENV
35+
36+ # builds the gem and saves the version to GITHUB_ENV
37+ - name : build
38+ run : echo "GEM_VERSION=$(gem build ${{ env.GEM_NAME }}.gemspec 2>&1 | grep Version | cut -d':' -f 2 | tr -d " \t\n\r")" >> $GITHUB_ENV
39+
40+ - name : publish to GitHub packages
41+ run : |
42+ export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 )
43+ GEM_HOST_API_KEY=${{ secrets.GITHUB_TOKEN }} gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} ${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem
44+
45+ - name : release
46+ uses :
ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # [email protected] 47+ with :
48+ artifacts : " ${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem"
49+ tag : " v${{ env.GEM_VERSION }}"
50+ generateReleaseNotes : true
51+
52+ - name : publish to RubyGems
53+ run : |
54+ mkdir -p ~/.gem
55+ echo -e "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials
56+ chmod 0600 ~/.gem/credentials
57+ gem push ${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem
58+ rm ~/.gem/credentials
You can’t perform that action at this time.
0 commit comments