Skip to content

Commit 72fea6e

Browse files
authored
Merge branch 'master' into PR/readability
2 parents 1ff2972 + 27db275 commit 72fea6e

File tree

2 files changed

+62
-63
lines changed

2 files changed

+62
-63
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: CI
22

33
on:
4-
push: {}
5-
pull_request_review:
6-
types: [submitted, edited]
4+
push:
5+
branches:
6+
- "*"
7+
pull_request_target: {}
78

89
jobs:
910
test:
@@ -50,63 +51,3 @@ jobs:
5051

5152
- name: Build gem
5253
run: gem build daemon_controller.gemspec
53-
54-
- name: Upload gem artifact
55-
uses: actions/upload-artifact@v4
56-
with:
57-
name: gem
58-
path: "daemon_controller-*.gem"
59-
60-
release:
61-
runs-on: ubuntu-24.04
62-
needs:
63-
- test
64-
- lint-and-build
65-
if: startsWith(github.ref, 'refs/tags/')
66-
environment: release
67-
permissions:
68-
contents: write
69-
id-token: write
70-
attestations: write
71-
steps:
72-
- name: Checkout code
73-
uses: actions/checkout@v4
74-
75-
- name: Set up Ruby
76-
uses: ruby/setup-ruby@v1
77-
with:
78-
ruby-version: "3.4"
79-
bundler-cache: true
80-
81-
- name: Verify version number
82-
id: get_version
83-
run: |
84-
VERSION_STRING=$(ruby -r ./lib/daemon_controller/version.rb -e "puts DaemonController::VERSION_STRING")
85-
if ! [[ "$GITHUB_REF_NAME" =~ ^release- ]]; then
86-
echo "Tag name must start with a 'release-'."
87-
exit 1
88-
fi
89-
if [[ "$GITHUB_REF_NAME" != "release-${VERSION_STRING}" ]]; then
90-
echo "Tag version ($GITHUB_REF_NAME) does not match version.rb ($VERSION_STRING)"
91-
exit 1
92-
fi
93-
94-
- name: Download gem artifact
95-
uses: actions/download-artifact@v4
96-
with:
97-
name: gem
98-
99-
- name: Create attestation
100-
uses: actions/attest-build-provenance@v2
101-
with:
102-
subject-path: "daemon_controller-*.gem"
103-
104-
- name: Push gem to RubyGems
105-
run: gem push daemon_controller-*.gem
106-
env:
107-
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
108-
109-
- name: Create GitHub release
110-
run: gh release create "$GITHUB_REF_NAME" *.gem --title "$GITHUB_REF_NAME" --notes-from-tag
111-
env:
112-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "release-*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-24.04
11+
needs:
12+
- lint-and-build
13+
if: startsWith(github.ref, 'refs/tags/')
14+
environment: release
15+
permissions:
16+
contents: write
17+
id-token: write
18+
attestations: write
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Ruby
24+
uses: ruby/setup-ruby@v1
25+
with:
26+
ruby-version: "3.4"
27+
bundler-cache: true
28+
29+
- name: Verify version number
30+
id: get_version
31+
run: |
32+
VERSION_STRING=$(ruby -r ./lib/daemon_controller/version.rb -e "puts DaemonController::VERSION_STRING")
33+
if ! [[ "$GITHUB_REF_NAME" =~ ^release- ]]; then
34+
echo "Tag name must start with a 'release-'."
35+
exit 1
36+
fi
37+
if [[ "$GITHUB_REF_NAME" != "release-${VERSION_STRING}" ]]; then
38+
echo "Tag version ($GITHUB_REF_NAME) does not match version.rb ($VERSION_STRING)"
39+
exit 1
40+
fi
41+
42+
- name: Build gem
43+
run: gem build daemon_controller.gemspec
44+
45+
- name: Create attestation
46+
uses: actions/attest-build-provenance@v2
47+
with:
48+
subject-path: "daemon_controller-*.gem"
49+
50+
- name: Push gem to RubyGems
51+
run: gem push daemon_controller-*.gem
52+
env:
53+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
54+
55+
- name: Create GitHub release
56+
run: gh release create "$GITHUB_REF_NAME" *.gem --title "$GITHUB_REF_NAME" --notes-from-tag
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)