fix(build): ensure Klogger::VERSION is set correctly in built gems #33
Workflow file for this run
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: Commit | |
on: push | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.1 | |
- name: Install dependencies | |
run: bundle install | |
- name: Run linter | |
run: bundle exec rubocop | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby_version: | |
- 2.6 | |
- 2.7 | |
- "3.0" | |
- 3.1 | |
- 3.2 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby_version }} | |
- name: Install dependencies | |
run: bundle install | |
- name: Run tests | |
run: bundle exec rspec | |
release: | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: actions/setup-ruby@v1 | |
with: | |
ruby-version: 3.1 | |
- name: Export version from tag name | |
run: echo ${GITHUB_REF/refs\/tags\//} > VERSION | |
- name: Build Gem | |
run: gem build *.gemspec | |
- name: Setup credentials | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials | |
env: | |
RUBYGEMS_API_KEY: ${{secrets.KRYSTAL_RUBYGEMS_API_KEY}} | |
- name: Publish to RubyGems | |
run: | | |
gem push *.gem |