File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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@v3
22+
23+ -
uses :
ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # [email protected] 24+ with :
25+ bundler-cache : true
26+
27+ - name : bootstrap
28+ run : script/bootstrap
29+
30+ - name : lint
31+ run : bundle exec rubocop -c .rubocop.yml lib/ spec/
32+
33+ - name : test
34+ run : script/test
35+
36+ - name : set GEM_NAME from gemspec
37+ run : echo "GEM_NAME=$(ls | grep gemspec | cut -d. -f1)" >> $GITHUB_ENV
38+
39+ # builds the gem and saves the version to GITHUB_ENV
40+ - name : build
41+ 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
42+
43+ - name : publish to GitHub packages
44+ run : |
45+ export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 )
46+ 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
47+
48+ - name : release
49+ uses :
ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # [email protected] 50+ with :
51+ artifacts : " ${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem"
52+ tag : " v${{ env.GEM_VERSION }}"
53+ generateReleaseNotes : true
54+
55+ - name : Publish to RubyGems
56+ run : |
57+ mkdir -p ~/.gem
58+ echo -e "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials
59+ chmod 0600 ~/.gem/credentials
60+ gem push ${{ env.GEM_NAME }}-${{ env.GEM_VERSION }}.gem
61+ rm ~/.gem/credentials
You can’t perform that action at this time.
0 commit comments