name: CI on: workflow_dispatch: {} push: branches: - master - beta - sdk-release/** - feature/** tags: - v[0-9]+.[0-9]+.[0-9]+* pull_request: branches: - master - beta - sdk-release/** - feature/** jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: 3.1 - name: Lint run: bundle install && bundle exec rake rubocop - name: Build run: gem build stripe.gemspec - name: 'Upload Artifact' uses: actions/upload-artifact@v2 with: name: gems path: '*.gem' test: name: Test (${{ matrix.ruby-version }}) runs-on: ubuntu-latest strategy: matrix: ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, jruby-9.2.16.0, truffleruby-head] steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - name: Start stripe-mock run: docker run -d -p 12111-12112:12111-12112 stripe/stripe-mock && sleep 5 - name: test run: bundle install && bundle exec rake test env: GITHUB_TOKEN: ${{ secrets.github_token }} COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} COVERALLS_SERVICE_NAME: github-action publish: name: Publish if: >- ((github.event_name == 'workflow_dispatch') || (github.event_name == 'push')) && startsWith(github.ref, 'refs/tags/v') && endsWith(github.actor, '-stripe') needs: [build, test] runs-on: ubuntu-latest steps: - name: Download all workflow run artifacts uses: actions/download-artifact@v2 with: name: gems path: gems - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: 3.1 - name: Publish gems to Rubygems run: gem push gems/*.gem env: GEM_HOST_API_KEY: ${{secrets.GEM_HOST_API_KEY}}