diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 82de858..a8418ff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,3 +51,32 @@ jobs: run: bundle install - name: Run tests run: bin/rspec + + release: + name: Publish to RubyGems + runs-on: ubuntu-latest + needs: [release-please, test, lint] + if: ${{ needs.release-please.outputs.release_created }} + steps: + - uses: actions/checkout@master + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + + - 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