name: Test and Release on: push: branches: - main jobs: tests: strategy: matrix: ruby: [2.5, 2.6, 2.7, 3.0] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - name: Install dependencies run: bundle install - name: Run linter run: bundle exec rubocop - name: Run tests run: bundle exec rspec release: needs: [tests] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: 3.0 - name: Install dependencies run: bundle install - name: Prepare credentials env: RUBYGEM_KEY: ${{ secrets.RUBYGEM_KEY }} run: "mkdir -p ~/.gem && echo -e \"---\\r\\n:rubygems_api_key: $RUBYGEM_KEY\" > ~/.gem/credentials && chmod 0600 ~/.gem/credentials" - name: Setup username/email run: "git config --global user.email zaratan@hey.com && git config --global user.name \"Denis Pasin\"" - name: Fetch tags from remote run: "git fetch -t" - name: Publish if version change run: 'git diff `git tag | tail -1` lib/rspec_in_context/version.rb | grep -E "^\+.*VERSION" && rake release || echo "No release for now"'