-
Notifications
You must be signed in to change notification settings - Fork 7
106 lines (99 loc) · 3.29 KB
/
Copy pathgem_release.yaml
File metadata and controls
106 lines (99 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
name: Gem Release
on:
push:
tags:
- '*'
permissions: {}
jobs:
build-release:
# Prevent releases from forked repositories
if: github.repository_owner == 'OpenVoxProject'
name: Build the gem
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install Ruby
uses: ruby/setup-ruby@0dafeac902942906541bc140009cdbf32665b601 # v1.315.0
with:
ruby-version: 'ruby'
- name: Build gem
shell: bash
run: gem build --verbose *.gemspec
- name: Upload gem to GitHub cache
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: gem-artifact
path: '*.gem'
retention-days: 1
compression-level: 0
create-github-release:
needs: build-release
name: Create GitHub release
runs-on: ubuntu-24.04
permissions:
contents: write # clone repo and create release
steps:
- name: Download gem from GitHub cache
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: gem-artifact
- name: Create Release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: gh release create --repo ${{ github.repository }} ${{ github.ref_name }} --generate-notes *.gem
release-to-github:
needs: build-release
name: Release to GitHub
runs-on: ubuntu-24.04
permissions:
packages: write # publish to rubygems.pkg.github.com
steps:
- name: Download gem from GitHub cache
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: gem-artifact
- name: Publish gem to GitHub packages
run: gem push --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem
env:
GEM_HOST_API_KEY: ${{ secrets.GITHUB_TOKEN }}
release-to-rubygems:
needs: build-release
name: Release gem to rubygems.org
runs-on: ubuntu-24.04
environment: release # recommended by rubygems.org
permissions:
id-token: write # rubygems.org authentication
steps:
- name: Download gem from GitHub cache
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: gem-artifact
- uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0
- name: Publish gem to rubygems.org
shell: bash
run: gem push *.gem
release-verification:
name: Check that all releases are done
runs-on: ubuntu-24.04
permissions:
contents: read # minimal permissions that we have to grant
needs:
- create-github-release
- release-to-github
- release-to-rubygems
steps:
- name: Download gem from GitHub cache
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: gem-artifact
- name: Install Ruby
uses: ruby/setup-ruby@0dafeac902942906541bc140009cdbf32665b601 # v1.315.0
with:
ruby-version: 'ruby'
- name: Wait for release to propagate
shell: bash
run: |
gem install rubygems-await
gem await *.gem