Create releases #20
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: Publish new version | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| publish-gem: | |
| name: Publish gem to rubygems.org | |
| if: github.repository == 'ruby-go-gem/go-gem-wrapper' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: rubygems.org | |
| url: https://rubygems.org/gems/go_gem | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@eaecf785f6a34567a6d97f686bbb7bccc1ac1e5c # v1.237.0 | |
| with: | |
| bundler-cache: true | |
| ruby-version: ruby | |
| - name: Publish to RubyGems | |
| uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1 | |
| create-release: | |
| needs: | |
| - publish-gem | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| actions: read | |
| pull-requests: read | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0 | |
| with: | |
| ruby-version: ruby | |
| bundler-cache: true | |
| - name: Generate changelog | |
| run: | | |
| version=$(bundle exec ruby -e 'puts GoGem::VERSION') | |
| bundle exec rake changelog[,v${version}] > /tmp/changelog.md | |
| cat /tmp/changelog.md | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create release | |
| uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2 | |
| with: | |
| body_path: /tmp/changelog.md | |
| - name: Slack Notification (not success) | |
| uses: act10ns/slack@cfcc30955fe9377f4f55e1079e5419ee1014269f # v2 | |
| if: "! success()" | |
| continue-on-error: true | |
| with: | |
| status: ${{ job.status }} | |
| webhook-url: ${{ secrets.SLACK_WEBHOOK }} |