Lock JSON version until find route cause #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test and Lint on Push and PR | |
| on: [push] | |
| jobs: | |
| test: | |
| runs-on: "ubuntu-20.04" | |
| strategy: | |
| matrix: | |
| ruby: | |
| - "2.7" | |
| - "3.0" | |
| - "3.1" | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: QuickPay/quickpay-base-action@v2.2 | |
| 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 }} |