Skip to content

Commit df77255

Browse files
author
Jonathan Wenger
committed
Update gem-push pipeline
1 parent 2632d50 commit df77255

File tree

1 file changed

+50
-23
lines changed

1 file changed

+50
-23
lines changed

.github/workflows/gem-push.yml

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,53 @@ jobs:
1313
packages: write
1414

1515
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Ruby 2.6
18-
uses: actions/setup-ruby@v1
19-
with:
20-
ruby-version: 2.6.x
21-
22-
- name: Run Integration Tests
23-
run: |
24-
gem install bundler:2.3.6
25-
bundle config set --local path 'vendor/bundle'
26-
bundle install
27-
USERNAME='${{ secrets.API_USERNAME }}' PASSWORD='${{ secrets.API_PASSWORD }}' bundle exec rspec
28-
29-
- name: Publish to RubyGems
30-
run: |
31-
mkdir -p $HOME/.gem
32-
touch $HOME/.gem/credentials
33-
chmod 0600 $HOME/.gem/credentials
34-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
35-
gem build avalara_sdk.gemspec
36-
gem push *.gem
37-
env:
38-
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
16+
- uses: actions/checkout@v2
17+
- name: Set env
18+
run: |
19+
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
20+
- name: Print Version
21+
run: |
22+
echo $VERSION
23+
echo ${{ env.VERSION }}
24+
- name: Set up Ruby 2.6
25+
uses: actions/setup-ruby@v1
26+
with:
27+
ruby-version: 2.6.x
28+
29+
- name: Retrieve bearer token
30+
id: get_bearer_token
31+
run: |
32+
response=$(curl -X POST ${{secrets.OKTA_ACCESS_TOKEN_URL}}/connect/token \
33+
-H "Content-Type: application/x-www-form-urlencoded" \
34+
-d "grant_type=client_credentials&client_id=${{secrets.OKTA_CLIENT_ID}}&client_secret=${{secrets.OKTA_CLIENT_SECRET}}")
35+
token=$(echo $response | jq -r '.access_token')
36+
echo "BEARER_TOKEN=${token}" >> $GITHUB_ENV
37+
38+
- name: Run Integration Tests
39+
run: |
40+
gem install bundler:2.3.6
41+
bundle config set --local path 'vendor/bundle'
42+
bundle install
43+
bundle exec rspec
44+
45+
- name: Update Ruby SDK version
46+
run: |
47+
sed -i "s/VERSION = '[0-9]*\.[0-9]*\.[0-9]*'/VERSION = '${{ env.VERSION }}'/g" ./lib/avalara_sdk/version.rb
48+
49+
- name: Update resources
50+
uses: test-room-7/action-update-file@v1
51+
with:
52+
file-path: ./lib/avalara_sdk/version.rb
53+
commit-msg: Commit Nuget Package
54+
github-token: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Publish to RubyGems
57+
run: |
58+
mkdir -p $HOME/.gem
59+
touch $HOME/.gem/credentials
60+
chmod 0600 $HOME/.gem/credentials
61+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
62+
gem build avalara_sdk.gemspec
63+
gem push *.gem
64+
env:
65+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"

0 commit comments

Comments
 (0)