attempt to fix and improve ci #28
This file contains 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: ci | |
on: | |
push: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby-version: ['3.0', '3.1', '3.2'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
- name: Install dependencies | |
run: bundle install | |
- name: Run tests | |
run: rspec . | |
publish: | |
name: Build and publish gem | |
if: github.ref == 'refs/heads/main' && needs.test.result == 'success' | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 | |
- name: Publish to GPR | |
run: | | |
curl -u $RUBYGEMS_USERNAME:$RUBYGEMS_PASSWORD https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials | |
gem build arxiv.gemspec | |
gem push `ls | grep *.gem` | |
env: | |
RUBYGEMS_USERNAME: "${{ secrets.RUBYGEMS_USERNAME }}" | |
RUBYGEMS_PASSWORD: "${{ secrets.RUBYGEMS_PASSWORD }}" |