Skip to content

Commit a77e6c6

Browse files
committed
CI: Apply Vox Pupuli best practices
1 parent a000d9d commit a77e6c6

File tree

3 files changed

+124
-18
lines changed

3 files changed

+124
-18
lines changed

.github/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
3+
4+
changelog:
5+
exclude:
6+
labels:
7+
- duplicate
8+
- invalid
9+
- modulesync
10+
- question
11+
- skip-changelog
12+
- wont-fix
13+
- wontfix
14+
- github_actions
15+
16+
categories:
17+
- title: Breaking Changes 🛠
18+
labels:
19+
- backwards-incompatible
20+
21+
- title: New Features 🎉
22+
labels:
23+
- enhancement
24+
25+
- title: Bug Fixes 🐛
26+
labels:
27+
- bug
28+
- bugfix
29+
30+
- title: Documentation Updates 📚
31+
labels:
32+
- documentation
33+
- docs
34+
35+
- title: Dependency Updates ⬆️
36+
labels:
37+
- dependencies
38+
39+
- title: Other Changes
40+
labels:
41+
- "*"

.github/workflows/release.yml

Lines changed: 80 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,96 @@
1-
name: Release
1+
---
2+
name: Gem Release
23

34
on:
45
push:
56
tags:
67
- '*'
78

89
jobs:
9-
release:
10-
runs-on: ubuntu-latest
10+
build-release:
11+
# Prevent releases from forked repositories
1112
if: github.repository_owner == 'voxpupuli'
13+
name: Build the gem
14+
runs-on: ubuntu-24.04
15+
permissions:
16+
contents: write # clone repo and create release
1217
steps:
1318
- uses: actions/checkout@v4
14-
- name: Install Ruby 3.3
19+
- name: Install Ruby
1520
uses: ruby/setup-ruby@v1
1621
with:
17-
ruby-version: '3.3'
18-
env:
19-
BUNDLE_WITHOUT: release
22+
ruby-version: 'ruby'
2023
- name: Build gem
21-
run: gem build --strict --verbose *.gemspec
24+
shell: bash
25+
run: gem build --verbose *.gemspec
26+
- name: Upload gem to GitHub cache
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: gem-artifact
30+
path: '*.gem'
31+
retention-days: 1
32+
compression-level: 0
33+
- name: Create Release Page
34+
shell: bash
35+
env:
36+
GH_TOKEN: ${{ github.token }}
37+
run: gh release create ${{ github.ref_name }} --generate-notes
38+
- name: Attach gem to GitHub Release
39+
shell: bash
40+
env:
41+
GH_TOKEN: ${{ github.token }}
42+
run: gh release upload ${{ github.ref_name }} *.gem
43+
44+
release-to-github:
45+
needs: build-release
46+
name: Release to GitHub
47+
runs-on: ubuntu-24.04
48+
permissions:
49+
packages: write # publish to rubygems.pkg.github.com
50+
steps:
51+
- name: Download gem from GitHub cache
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: gem-artifact
55+
- name: Publish gem to GitHub packages
56+
run: GEM_HOST_API_KEY=${{ secrets.GITHUB_TOKEN }} gem push --key github --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem
57+
58+
release-to-rubygems:
59+
needs: build-release
60+
name: Release gem to rubygems.org
61+
runs-on: ubuntu-24.04
62+
environment: release # recommended by rubygems.org
63+
permissions:
64+
id-token: write # rubygems.org authentication
65+
steps:
66+
- name: Download gem from GitHub cache
67+
uses: actions/download-artifact@v4
68+
with:
69+
name: gem-artifact
70+
- uses: rubygems/[email protected]
2271
- name: Publish gem to rubygems.org
72+
shell: bash
2373
run: gem push *.gem
24-
env:
25-
GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
26-
- name: Setup GitHub packages access
74+
75+
release-verification:
76+
name: Check that all releases are done
77+
runs-on: ubuntu-24.04
78+
permissions:
79+
contents: read # minimal permissions that we have to grant
80+
needs:
81+
- release-to-github
82+
- release-to-rubygems
83+
steps:
84+
- name: Download gem from GitHub cache
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: gem-artifact
88+
- name: Install Ruby
89+
uses: ruby/setup-ruby@v1
90+
with:
91+
ruby-version: 'ruby'
92+
- name: Wait for release to propagate
93+
shell: bash
2794
run: |
28-
mkdir -p ~/.gem
29-
echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
30-
chmod 0600 ~/.gem/credentials
31-
- name: Publish gem to GitHub packages
32-
run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem
95+
gem install rubygems-await
96+
gem await *.gem

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ on:
1010
env:
1111
BUNDLE_WITHOUT: release
1212

13+
permissions:
14+
contents: read # minimal permissions that we have to grant
15+
1316
jobs:
1417
rubocop_and_matrix:
15-
env:
16-
BUNDLE_WITHOUT: release
1718
runs-on: ubuntu-24.04
1819
outputs:
1920
ruby: ${{ steps.ruby.outputs.versions }}

0 commit comments

Comments
 (0)