8
8
- cron : ' 0 19 * * *'
9
9
jobs :
10
10
prepare :
11
- name : Check if the latest jruby commit is already built
11
+ name : Check if the latest jruby snapshot is already built
12
12
runs-on : ubuntu-latest
13
13
outputs :
14
14
should_build : ${{ steps.check_commit.outputs.result }}
15
- commit : ${{ steps.latest_commit .outputs.commit }}
15
+ url : ${{ steps.url .outputs.url }}
16
16
steps :
17
- - name : Clone jruby
17
+ - name : Clone to get find- jruby-head-url-nokogiri.rb
18
18
uses : actions/checkout@v4
19
+ - uses : ruby/setup-ruby@v1
19
20
with :
20
- repository : jruby/jruby
21
- path : jruby
22
- - name : Set latest_commit
23
- id : latest_commit
24
- working-directory : jruby
25
- run : echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
26
-
21
+ ruby-version : ruby
22
+ bundler-cache : true
23
+ - name : Get latest jruby nightly archive url
24
+ id : url
25
+ run : |
26
+ echo "url=$(bundle exec ruby find-jruby-head-url-nokogiri.rb)" | tee -a "$GITHUB_OUTPUT"
27
27
- name : Check if latest commit already built
28
28
uses : actions/github-script@v7
29
29
id : check_commit
30
30
with :
31
31
script : |
32
- const latestDevCommit = "${{ steps.latest_commit .outputs.commit }}"
32
+ const latestSnapshotUrl = "${{ steps.url .outputs.url }}"
33
33
const { owner, repo } = context.repo
34
34
let { data: release } = await github.rest.repos.getLatestRelease({ owner, repo })
35
- const latestReleaseCommit = release.body.split('@' )[1]
36
- console.log(`Latest release commit : ${latestReleaseCommit }`)
37
- console.log(`Latest jruby commit : ${latestDevCommit }`)
38
- if (latestReleaseCommit === latestDevCommit ) {
35
+ const latestTaggedUrl = release.body.split(/\s+/ )[1]
36
+ console.log(`Latest snapshot url : ${latestSnapshotUrl }`)
37
+ console.log(`Latest tagged url : ${latestTaggedUrl }`)
38
+ if (latestSnapshotUrl === latestTaggedUrl ) {
39
39
return 'false'
40
40
} else {
41
41
return 'true'
45
45
release :
46
46
name : Create GitHub Release
47
47
needs : [prepare]
48
- # We don't build JRuby from the repo commit but from latest maven snapshort, so always run
49
- # if: needs.prepare.outputs.should_build == 'true'
48
+ if : needs.prepare.outputs.should_build == 'true'
50
49
runs-on : ubuntu-latest
51
50
outputs :
52
51
tag : ${{ steps.tag.outputs.tag }}
71
70
GH_REPO : ${{ github.repository }}
72
71
run : |
73
72
tag="${{ steps.tag.outputs.tag }}"
74
- body="jruby/jruby@${{ needs.prepare.outputs.commit }}"
75
- gh release create --draft "$tag" --title "$tag" --notes "$body"
73
+ gh release create --draft "$tag" --title "$tag"
76
74
77
75
build :
78
76
needs : [prepare, release]
81
79
matrix :
82
80
os : [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, ubuntu-22.04-arm, ubuntu-24.04-arm, macos-13, macos-14, windows-2019 ]
83
81
runs-on : ${{ matrix.os }}
82
+ outputs :
83
+ commit : ${{ steps.latest_commit.outputs.commit }}
84
84
steps :
85
85
- name : Set platform
86
86
id : platform
@@ -94,18 +94,11 @@ jobs:
94
94
echo "platform=$platform" >> $GITHUB_OUTPUT
95
95
96
96
# Build
97
- - name : Clone this repo to get find-jruby-head-url-nokogiri.rb
97
+ - name : Clone to get test/Gemfile
98
98
uses : actions/checkout@v4
99
- - uses : ruby/setup-ruby@master
100
- with :
101
- ruby-version : ruby
102
99
- name : Download latest jruby nightly archive
103
100
shell : bash
104
- run : |
105
- gem install nokogiri
106
- url=$(ruby find-jruby-head-url-nokogiri.rb)
107
- echo "$url"
108
- curl --fail -L -o jruby-head.tar.gz "$url"
101
+ run : curl --fail -L -o jruby-head.tar.gz "${{ needs.prepare.outputs.url }}"
109
102
- uses : eregon/clean-path@v1
110
103
with :
111
104
regexp : ' \bruby\b'
@@ -157,8 +150,15 @@ jobs:
157
150
- run : ruby -ropen-uri -e 'puts URI.send(:open, %{https://rubygems.org/}) { |f| f.read(1024) }'
158
151
- run : gem install json:2.2.0 --no-document
159
152
- run : bundle --version
153
+ working-directory : test
160
154
- run : bundle install
155
+ working-directory : test
161
156
- run : bundle exec rake --version
157
+ working-directory : test
158
+
159
+ - name : Set latest_commit
160
+ id : latest_commit
161
+ run : echo "commit=$(ruby -e 'puts JRUBY_REVISION')" >> $GITHUB_OUTPUT
162
162
163
163
- name : Upload Built Ruby
164
164
env :
@@ -168,14 +168,16 @@ jobs:
168
168
169
169
publish :
170
170
name : Publish Release
171
- needs : [release, build]
171
+ needs : [prepare, release, build]
172
172
runs-on : ubuntu-latest
173
173
steps :
174
174
- name : Publish Release
175
175
env :
176
176
GH_TOKEN : ${{ github.token }}
177
177
GH_REPO : ${{ github.repository }}
178
- run : gh release edit "${{ needs.release.outputs.tag }}" --draft=false
178
+ run : |
179
+ body="jruby/jruby@${{ needs.build.outputs.commit }} ${{ needs.prepare.outputs.url }}"
180
+ gh release edit "${{ needs.release.outputs.tag }}" --draft=false --notes "$body"
179
181
- uses : eregon/keep-last-n-releases@v1
180
182
env :
181
183
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments