88 - cron : ' 0 19 * * *'
99jobs :
1010 prepare :
11- name : Check if the latest jruby commit is already built
11+ name : Check if the latest jruby snapshot is already built
1212 runs-on : ubuntu-latest
1313 outputs :
1414 should_build : ${{ steps.check_commit.outputs.result }}
15- commit : ${{ steps.latest_commit .outputs.commit }}
15+ url : ${{ steps.url .outputs.url }}
1616 steps :
17- - name : Clone jruby
17+ - name : Clone to get find- jruby-head-url-nokogiri.rb
1818 uses : actions/checkout@v4
19+ - uses : ruby/setup-ruby@v1
1920 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"
2727 - name : Check if latest commit already built
2828 uses : actions/github-script@v7
2929 id : check_commit
3030 with :
3131 script : |
32- const latestDevCommit = "${{ steps.latest_commit .outputs.commit }}"
32+ const latestSnapshotUrl = "${{ steps.url .outputs.url }}"
3333 const { owner, repo } = context.repo
3434 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 ) {
3939 return 'false'
4040 } else {
4141 return 'true'
4545 release :
4646 name : Create GitHub Release
4747 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'
5049 runs-on : ubuntu-latest
5150 outputs :
5251 tag : ${{ steps.tag.outputs.tag }}
7170 GH_REPO : ${{ github.repository }}
7271 run : |
7372 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"
7674
7775 build :
7876 needs : [prepare, release]
8179 matrix :
8280 os : [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, ubuntu-22.04-arm, ubuntu-24.04-arm, macos-13, macos-14, windows-2019 ]
8381 runs-on : ${{ matrix.os }}
82+ outputs :
83+ commit : ${{ steps.latest_commit.outputs.commit }}
8484 steps :
8585 - name : Set platform
8686 id : platform
@@ -94,18 +94,11 @@ jobs:
9494 echo "platform=$platform" >> $GITHUB_OUTPUT
9595
9696 # Build
97- - name : Clone this repo to get find-jruby-head-url-nokogiri.rb
97+ - name : Clone to get test/Gemfile
9898 uses : actions/checkout@v4
99- - uses : ruby/setup-ruby@master
100- with :
101- ruby-version : ruby
10299 - name : Download latest jruby nightly archive
103100 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 }}"
109102 - uses : eregon/clean-path@v1
110103 with :
111104 regexp : ' \bruby\b'
@@ -157,8 +150,15 @@ jobs:
157150 - run : ruby -ropen-uri -e 'puts URI.send(:open, %{https://rubygems.org/}) { |f| f.read(1024) }'
158151 - run : gem install json:2.2.0 --no-document
159152 - run : bundle --version
153+ working-directory : test
160154 - run : bundle install
155+ working-directory : test
161156 - 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
162162
163163 - name : Upload Built Ruby
164164 env :
@@ -168,14 +168,16 @@ jobs:
168168
169169 publish :
170170 name : Publish Release
171- needs : [release, build]
171+ needs : [prepare, release, build]
172172 runs-on : ubuntu-latest
173173 steps :
174174 - name : Publish Release
175175 env :
176176 GH_TOKEN : ${{ github.token }}
177177 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"
179181 - uses : eregon/keep-last-n-releases@v1
180182 env :
181183 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments