-
Notifications
You must be signed in to change notification settings - Fork 7
63 lines (61 loc) · 2.07 KB
/
test_and_lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Test and Lint on Push and PR
on: [push]
jobs:
test:
runs-on: "ubuntu-20.04"
strategy:
matrix:
ruby:
- "2.6"
- "2.7"
- "3.0"
- "3.1"
steps:
- uses: actions/checkout@v2
- uses: QuickPay/[email protected]
with:
rubocop: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake
publish:
runs-on: "ubuntu-20.04"
needs:
test
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- name: Setup gem credentials
run: |
mkdir ~/.gem && echo ":rubygems_api_key: ${{secrets.BUNDLE_RUBYGEMS__ORG}}" > ~/.gem/credentials && chmod 0600 ~/.gem/credentials
- name: Retrieve versions
run: |
echo "##[set-output name=versions;]$(gem search '^quickpay-ruby-client$' --all --prerelease | grep -o '\((.*)\)$' | tr -d '() ' | tr ',' "|" | sort)"
id: extract_versions
- name: Retrieve Current Versions
run: |
ruby -e "
require './lib/quickpay/api/version.rb'
versions = '${{ steps.extract_versions.outputs.versions }}'.strip.split('|').map {|x| Gem::Version.new x }
unless versions.include? Gem::Version.new(QuickPay::API::VERSION)
puts('##[set-output name=version;]' + QuickPay::API::VERSION)
end
"
id: extract_version
- name: Push gem
if: ${{ steps.extract_version.outputs.version != '' }}
run: gem build && gem push *.gem
- name: Create Release
if: ${{ steps.extract_version.outputs.version != '' }}
uses: zendesk/action-create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.extract_version.outputs.version }}
release_name: Release ${{ steps.extract_version.outputs.version }}