Skip to content

Commit a668a3a

Browse files
committed
Add GitHub Packages publishing workflow
- Add .github/workflows/publish-gem.yml for automated gem publishing - Add gemspec metadata for GitHub Packages - Add *.gem to .gitignore - Support both v* and plain semver tags
1 parent 045d7e9 commit a668a3a

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

.github/workflows/publish-gem.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish Gem to GitHub Packages
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
- "[0-9]+.[0-9]+.[0-9]+"
8+
workflow_dispatch:
9+
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Ruby
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: "2.5"
24+
bundler-cache: true
25+
26+
- name: Build gem
27+
run: gem build *.gemspec
28+
29+
- name: Configure gem credentials
30+
run: |
31+
mkdir -p ~/.gem
32+
cat << EOF > ~/.gem/credentials
33+
---
34+
:github: Bearer ${{ secrets.GITHUB_TOKEN }}
35+
EOF
36+
chmod 0600 ~/.gem/credentials
37+
38+
- name: Push to GitHub Packages
39+
run: |
40+
gem push --key github \
41+
--host https://rubygems.pkg.github.com/customink \
42+
*.gem

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pkg/*
22
rdoc/*
3+
*.gem

moqueue.gemspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ Gem::Specification.new do |s|
5353
]
5454
s.homepage = "https://github.com/customink/moqueue"
5555
s.licenses = ["MIT"]
56+
57+
s.metadata["github_repo"] = "ssh://github.com/customink/moqueue"
58+
s.metadata["allowed_push_host"] = "https://rubygems.pkg.github.com/customink"
5659
s.require_paths = ["lib"]
5760
s.rubygems_version = "1.8.17"
5861
s.summary = "Mocktacular Companion to AMQP Library. Happy TATFTing!"

0 commit comments

Comments
 (0)