Update all Bundler dependencies (2024-01-15) (#214) #148
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: Default | |
on: | |
- push | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
ruby_version: | |
- '3.0' | |
- '3.1' | |
- '3.2' | |
name: Build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: ${{ matrix.ruby_version }} | |
- name: Fetch main branch | |
run: git fetch origin main | |
- uses: r7kamura/rubocop-problem-matchers-action@v1 | |
- name: Lint | |
run: | | |
bundle exec rubocop | |
bundle exec bundle-audit update | |
bundle exec bundle-audit check | |
- name: Run rspec | |
run: bundle exec rspec | |
- name: Check if version has changed | |
if: ${{ github.ref_name == 'main' }} | |
id: version-check | |
run: | | |
if [ "$(git diff --name-only HEAD^ HEAD | grep 'lib/ws/style/version.rb')" ]; then | |
echo "Version did change" | |
echo "version_changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "Version did not change" | |
echo "version_changed=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Release the gem | |
if: ${{ github.ref_name == 'main' && steps.version-check.outputs.version_changed == 'true' && matrix.ruby_version == '3.0' }} | |
run: | | |
mkdir -p ~/.gem | |
cat << EOF > ~/.gem/credentials | |
--- | |
:github: Bearer ${GITHUB_TOKEN} | |
:rubygems_api_key: ${RUBYGEMS_API_KEY} | |
EOF | |
chmod 0600 ~/.gem/credentials | |
git config user.email "noreply@wealthsimple.com" | |
git config user.name "Wolfbot" | |
bundle exec rake release | |
env: | |
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} |