Merge pull request #33 from Fryguy/test_versions #6
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: | |
branches: [master] | |
tags: ['*'] | |
pull_request: | |
branches: [master] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
environment: ci | |
strategy: | |
matrix: | |
ruby-version: | |
- '2.7' | |
- '3.0' | |
- '3.1' | |
- '3.2' | |
- '3.3' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
bundler-cache: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install bumpversion | |
npm install -g semantic-release @semantic-release/exec @semantic-release/git @semantic-release/github @semantic-release/commit-analyzer | |
bundle install | |
- name: Run tests | |
run: bundle exec rake | |
- name: Install release dependencies | |
if: github.ref == 'refs/heads/master' && matrix.ruby-version == '2.7' | |
run: | | |
npm install -g semantic-release @semantic-release/changelog @semantic-release/exec @semantic-release/git @semantic-release/github | |
- name: Semantic Release and Publish | |
if: github.ref == 'refs/heads/master' && matrix.ruby-version == '2.7' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | |
run: | | |
npx semantic-release | |
# If semantic-release was successful, publish to RubyGems | |
if [ $? -eq 0 ]; then | |
gem build *.gemspec | |
gem push *.gem | |
fi |