Skip to content

Commit d2149f7

Browse files
committed
Test gem package publishing (to Github Packages)
1 parent dd27e44 commit d2149f7

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ permissions:
1010
actions: write
1111
contents: read
1212
id-token: write
13+
packages: write
1314

1415
jobs:
1516
test:
@@ -72,3 +73,32 @@ jobs:
7273
gem install bundler-audit
7374
bundle audit --update || true
7475
continue-on-error: true
76+
77+
publish:
78+
runs-on: ubuntu-latest
79+
needs: [test, security]
80+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
81+
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- name: Set up Ruby
86+
uses: ruby/setup-ruby@v1
87+
with:
88+
ruby-version: "3.3"
89+
bundler-cache: true
90+
91+
- name: Modify version for develop branch
92+
if: github.ref == 'refs/heads/develop'
93+
run: |
94+
sed -i "s/VERSION = '\([^']*\)'/VERSION = '\1.rc'/" lib/sudo/constants.rb
95+
96+
- name: Build gem
97+
run: gem build sudo.gemspec
98+
99+
- name: Publish to GitHub Packages
100+
run: |
101+
mkdir -p ~/.gem
102+
echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
103+
chmod 600 ~/.gem/credentials
104+
gem push *.gem --host https://rubygems.pkg.github.com/TwilightCoders

lib/sudo/constants.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'pathname'
22

33
module Sudo
4-
VERSION = '0.4.0-rc1'
4+
VERSION = '0.4.0'
55

66
def self.root
77
@root ||= Pathname.new(File.expand_path('../../', __dir__))

0 commit comments

Comments
 (0)