Skip to content

ci: CI/CD workflow

ci: CI/CD workflow #4

Workflow file for this run

name: Prod Release
on:
push:
branches:
- main
permissions:
contents: read
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop --parallel
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codespell
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Check spelling with codespell
run: codespell --ignore-words=codespell.txt || exit 1
unit_test:
runs-on: ubuntu-latest
needs: [rubocop, codespell]
strategy:
fail-fast: false
matrix:
gemfile:
- rails_5.2_stable
- rails_6.0_stable
- rails_6.1_stable
- rails_7.0_stable
- rails_edge
ruby: ['2.7', '3.0', '3.1', '3.2']
exclude:
- ruby: '3.0'
gemfile: rails_5.2_stable
- ruby: '3.1'
gemfile: rails_5.2_stable
- ruby: '3.2'
gemfile: rails_5.2_stable
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Suppress git warnings
run: git config --global init.defaultBranch main
- name: Run RSpec
run: bundle exec rspec
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
needs: [unit_test]
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: ruby
changelog-types: '[{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"docs","section":"Documentation","hidden":false},
{"type":"test","section":"Tests","hidden":false},
{"type":"chore","section":"Miscellaneous","hidden":false},
{"type":"ci","section":"Miscellaneous","hidden":false}]'
- name: Push to Release Branch
if: ${{ steps.release.outputs.release_created }}
uses: actions/github-script@v6
env:
MAJOR_VERSION: ${{ steps.release.outputs.major }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${process.env.MAJOR_VERSION}-stable`,
sha: context.sha,
force: true
});