Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 55 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,62 @@
name: Create releases
name: Publish new version

on:
push:
tags:
- "v*"

permissions:
contents: write
actions: read
pull-requests: read
workflow_dispatch:

jobs:
publish:
publish-gem:
name: Publish gem to rubygems.org

if: github.repository == 'ruby-go-gem/go-gem-wrapper'
runs-on: ubuntu-latest

defaults:
run:
shell: bash
working-directory: _gem/

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
Expand All @@ -24,13 +66,13 @@ jobs:

- name: Generate changelog
run: |
bundle exec rake changelog[,${TAG_NAME}] > /tmp/changelog.md
version=$(bundle exec ruby -e 'puts GoGem::VERSION')
bundle exec rake changelog[,v${version}] > /tmp/changelog.md
cat /tmp/changelog.md
env:
TAG_NAME: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release
- name: Create release
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2
with:
body_path: /tmp/changelog.md
Expand Down
7 changes: 0 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ end

Dir["#{__dir__}/_tasks/*.rake"].each { |f| load f }

desc "Release package"
task :release do
Dir.chdir(File.join(__dir__, "_gem")) do
sh "rake release"
end
end

desc "Generate changelog entry"
task :changelog, [:before, :after] do |_, params|
args = []
Expand Down
Loading