build(main): release 0.2.1 (#33) #63
This file contains hidden or 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: release-please | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| GEM_NAME: "semian-postgres" | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Release Please! | |
| uses: google-github-actions/release-please-action@v4 | |
| id: release | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| needs: release-please | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| - name: Build gem | |
| run: | | |
| gem build ${{ env.GEM_NAME }}.gemspec -o ${{ env.GEM_NAME }}.gem | |
| - name: Set Credentials | |
| run: | | |
| mkdir -p $HOME/.gem | |
| touch $HOME/.gem/credentials | |
| chmod 0600 $HOME/.gem/credentials | |
| printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" >> $HOME/.gem/credentials | |
| printf -- ":rubygems_api_key: Bearer ${RUBYGEMS_TOKEN}\n" >> $HOME/.gem/credentials | |
| - name: Publish to GitHub Packages | |
| if: always() | |
| env: | |
| GEM_HOST_API_KEY: ${{secrets.GITHUB_TOKEN}} | |
| run: | | |
| export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 ) | |
| gem push --host https://rubygems.pkg.github.com/${OWNER} *.gem | |
| - name: Publish to RubyGems | |
| if: always() | |
| env: | |
| GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_TOKEN}} | |
| run: | | |
| gem push --host https://rubygems.org *.gem |