Skip to content

Commit b9df9cb

Browse files
authored
Upload Windows binaries earlier (JabRef#10402)
1 parent 01f65ea commit b9df9cb

File tree

5 files changed

+89
-151
lines changed

5 files changed

+89
-151
lines changed

.github/workflows/deployment-arm64.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,6 @@ jobs:
172172
if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
173173
shell: bash
174174
run: |
175-
mkdir ${{runner.temp}}/sshkey
176-
if [[ -z "${{ secrets.buildJabRefPrivateKey }}" ]]; then
177-
echo "buildJabRefPrivateKey is empty, exiting"
178-
exit 1
179-
fi
180175
rsync -Pavz --itemize-changes --stats --partial-dir=/tmp/partial --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync" -e 'ssh -p 9922 -i ~/.ssh/id_rsa' build/distribution/ [email protected]:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/
181176
- name: Upload to GitHub workflow artifacts store
182177
if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}

.github/workflows/deployment.yml

Lines changed: 81 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ jobs:
5353
displayName: macOS
5454
eaJDK: https://files.jabref.org/jdks/jdk-macos-x64.tar.gz
5555
runs-on: ${{ matrix.os }}
56-
name: Create installer and portable version for ${{ matrix.displayName }}
56+
outputs:
57+
major: ${{ steps.gitversion.outputs.Major }}
58+
minor: ${{ steps.gitversion.outputs.Minor }}
59+
branchname: ${{ steps.gitversion.outputs.branchName }}
60+
name: ${{ matrix.displayName }} installer and portable version
5761
steps:
5862
- name: Check secrets presence
5963
id: checksecrets
@@ -105,7 +109,7 @@ jobs:
105109
cat gradle.properties
106110
107111
sed -i "s/JavaLanguageVersion.of(20)/JavaLanguageVersion.of(21)/" build.gradle
108-
- name: Setup JDK jabref-fix (ubuntu)
112+
- name: Setup JDK jabref-fix (linux)
109113
if: (matrix.os == 'ubuntu-latest')
110114
shell: bash
111115
run: |
@@ -134,31 +138,24 @@ jobs:
134138
cat gradle.properties
135139
136140
sed -i'.bak' -e "s/JavaLanguageVersion.of(20)/JavaLanguageVersion.of(21)/" build.gradle
137-
- name: Setup OSX key chain (macOS)
141+
- name: Setup macOS key chain
138142
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
139143
uses: apple-actions/import-codesign-certs@v2
140144
with:
141145
p12-file-base64: ${{ secrets.OSX_SIGNING_CERT }}
142146
p12-password: ${{ secrets.OSX_CERT_PWD }}
143147
keychain-password: jabref
144-
- name: Setup OSX key chain on OSX for app id cert (macOS)
148+
- name: Setup macOS key chain for app id cert
145149
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
146150
uses: apple-actions/import-codesign-certs@v2
147151
with:
148152
p12-file-base64: ${{ secrets.OSX_SIGNING_CERT_APPLICATION }}
149153
p12-password: ${{ secrets.OSX_CERT_PWD }}
150154
create-keychain: false
151155
keychain-password: jabref
152-
- name: Build runtime image (non-macOS)
153-
if: (matrix.os != 'macos-latest')
154-
run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip
155-
- name: Prepare merged jars and modules dir (macos)
156+
- name: Prepare merged jars and modules dir (macOS)
156157
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
157158
run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" prepareModulesDir
158-
- name: Build installer (non-macos)
159-
if: (matrix.os != 'macos-latest')
160-
shell: bash
161-
run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage
162159
- name: Build dmg (macOS)
163160
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
164161
shell: bash
@@ -209,7 +206,11 @@ jobs:
209206
--resource-dir buildres/mac \
210207
--file-associations buildres/mac/bibtexAssociations.properties \
211208
--jlink-options --bind-services
212-
- name: Package application image (non-macOS)
209+
- name: Build runtime image and installer (linux, Windows)
210+
if: (matrix.os != 'macos-latest')
211+
shell: bash
212+
run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage jlinkZip
213+
- name: Package application image (linux, Windows)
213214
if: (matrix.os != 'macos-latest')
214215
shell: bash
215216
run: ${{ matrix.archivePortable }}
@@ -230,35 +231,47 @@ jobs:
230231
ar -m -c -a sdsd jabref_${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}_amd64_repackaged.deb debian-binary control.tar.xz data.tar.xz
231232
rm debian-binary control.tar.* data.tar.*
232233
mv -f jabref_${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}_amd64_repackaged.deb jabref_${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}_amd64.deb
233-
- name: Upload to builds.jabref.org (ubuntu)
234-
if: (matrix.os == 'ubuntu-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
235-
uses: Pendect/[email protected]
236-
env:
237-
DEPLOY_KEY: ${{ secrets.buildJabRefPrivateKey }}
238-
with:
239-
flags: -vaz --itemize-changes --stats --partial-dir=/tmp/partial --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync"
240-
options: ''
241-
ssh_options: '-p 9922'
242-
src: 'build/distribution/'
243-
dest: [email protected]:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/
244-
- name: Upload to GitHub workflow artifacts store (Windows)
245-
if: (matrix.os == 'windows-latest') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
246-
uses: actions/upload-artifact@v3
247-
with:
248-
name: JabRef-${{ matrix.displayName }}
249-
path: build/distribution
250-
- name: Upload to GitHub workflow artifacts store (macOS)
234+
- name: Setup rsync (macOS)
251235
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
236+
run: brew install rsync
237+
- name: Setup rsync (Windows)
238+
if: (matrix.os == 'windows-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
239+
# We want to have rsync available at this place to avoid uploading and downloading from GitHub artifact store (taking > 5 minutes in total)
240+
# We cannot use "action-rsyncer", because that requires Docker which is unavailable on Windows
241+
# We cannot use "setup-rsync", because that does not work on Windows
242+
# We do not use egor-tensin/setup-cygwin@v4, because it replaces the default shell
243+
run: choco install --no-progress rsync
244+
- name: Setup ssh key
245+
if: (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
246+
run: |
247+
echo "${{ secrets.buildJabRefPrivateKey }}" > sshkey
248+
chmod 600 sshkey
249+
- name: Upload to builds.jabref.org (Windows)
250+
if: (matrix.os == 'windows-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
251+
shell: cmd
252+
# for rsync installed by chocolatey, we need the ssh.exe delivered with that installation
253+
run: |
254+
rsync -rt --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --itemize-changes --stats --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync" -e 'C:\ProgramData\chocolatey\lib\rsync\tools\bin\ssh.exe -p 9922 -i sshkey -o StrictHostKeyChecking=no' build/distribution/ [email protected]:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/
255+
- name: Upload to builds.jabref.org (linux, macOS)
256+
# macOS: Negated condition of "Upload to GitHub workflow artifacts store (macOS)"
257+
# Reason: We either upload the non-notarized files - or notarize the files later (and upload these later)
258+
# needs to be on one line; multi line does not work
259+
if: ${{ (!startsWith(github.ref, 'refs/heads/gh-readonly-queue')) && (steps.checksecrets.outputs.secretspresent == 'YES') && ((matrix.os == 'ubuntu-latest') || ((matrix.os == 'macos-latest') && !((startsWith(github.ref, 'refs/tags/') || inputs.notarization == true)))) }}
260+
shell: bash
261+
run: |
262+
rsync -rt --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --itemize-changes --stats --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync" -e 'ssh -p 9922 -i sshkey -o StrictHostKeyChecking=no' build/distribution/ [email protected]:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/
263+
- name: Upload to GitHub workflow artifacts store (macOS)
264+
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (startsWith(github.ref, 'refs/tags/') || inputs.notarization == true)
252265
uses: actions/upload-artifact@v3
253266
with:
254267
# tbn = to-be-notarized
255268
name: JabRef-macOS-tbn
256269
path: build/distribution
257-
notarize: # outsourced in a separate job to be able to rerun if this fails for timeouts
258-
name: Notarize and package macOS binaries
259-
runs-on: macos-latest
270+
announce:
271+
name: Comment on pull request
272+
runs-on: ubuntu-latest
260273
needs: [build]
261-
if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
274+
if: ${{ github.event_name == 'pull_request' }}
262275
steps:
263276
- name: Check secrets presence
264277
id: checksecrets
@@ -271,59 +284,19 @@ jobs:
271284
fi
272285
env:
273286
BUILDJABREFPRIVATEKEY: ${{ secrets.buildJabRefPrivateKey }}
274-
- name: Fetch all history for all tags and branches
275-
if: steps.checksecrets.outputs.secretspresent == 'YES'
276-
uses: actions/checkout@v4
277-
with:
278-
fetch-depth: 0
279-
submodules: 'true'
280-
show-progress: 'false'
281-
- name: Install GitVersion
282-
if: steps.checksecrets.outputs.secretspresent == 'YES'
283-
uses: gittools/actions/gitversion/[email protected]
284-
with:
285-
versionSpec: "5.x"
286-
- name: Run GitVersion
287-
if: steps.checksecrets.outputs.secretspresent == 'YES'
288-
id: gitversion
289-
uses: gittools/actions/gitversion/[email protected]
290-
- name: Get macOS binaries
287+
- name: Comment PR
291288
if: steps.checksecrets.outputs.secretspresent == 'YES'
292-
uses: actions/download-artifact@master
293-
with:
294-
name: JabRef-macOS-tbn
295-
path: build/distribution/
296-
- name: Notarize dmg
297-
if: (steps.checksecrets.outputs.secretspresent == 'YES') && (startsWith(github.ref, 'refs/tags/') || inputs.notarization == true)
298-
shell: bash
299-
run: |
300-
xcrun notarytool store-credentials "notarytool-profile" --apple-id "[email protected]" --team-id "6792V39SK3" --password "${{ secrets.OSX_NOTARIZATION_APP_PWD }}"
301-
xcrun notarytool submit build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}.dmg --keychain-profile "notarytool-profile" --wait
302-
xcrun stapler staple build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}.dmg
303-
- name: Notarize pkg
304-
if: (steps.checksecrets.outputs.secretspresent == 'YES') && (startsWith(github.ref, 'refs/tags/') || inputs.notarization == true)
305-
shell: bash
306-
run: |
307-
xcrun notarytool store-credentials "notarytool-profile" --apple-id "[email protected]" --team-id "6792V39SK3" --password "${{ secrets.OSX_NOTARIZATION_APP_PWD }}"
308-
xcrun notarytool submit build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}.pkg --keychain-profile "notarytool-profile" --wait
309-
xcrun stapler staple build/distribution/JabRef-${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}.pkg
310-
- name: Package application image
311-
if: (steps.checksecrets.outputs.secretspresent == 'YES') && (matrix.os != 'macos-latest')
312-
shell: bash
313-
run: ${{ matrix.archivePortable }}
314-
- name: Upload to GitHub workflow artifacts store
315-
if: (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
316-
uses: actions/upload-artifact@v3
289+
uses: thollander/actions-comment-pull-request@v2
317290
with:
318-
name: JabRef-macOS
319-
path: build/distribution
320-
upload:
321-
strategy:
322-
fail-fast: false
323-
name: Upload binaries on builds.jabref.org
324-
runs-on: ubuntu-latest
325-
needs: [build, notarize]
326-
if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
291+
message: |
292+
The build of this PR is available at <https://builds.jabref.org/pull/${{ github.event.pull_request.number }}/merge>.
293+
comment_tag: download-link
294+
mode: recreate
295+
notarize: # outsourced in a separate job to be able to rerun if this fails for timeouts
296+
name: macOS notarization
297+
runs-on: macos-latest
298+
needs: [build]
299+
if: ${{ startsWith(github.ref, 'refs/tags/') || inputs.notarization == true }}
327300
steps:
328301
- name: Check secrets presence
329302
id: checksecrets
@@ -336,58 +309,30 @@ jobs:
336309
fi
337310
env:
338311
BUILDJABREFPRIVATEKEY: ${{ secrets.buildJabRefPrivateKey }}
339-
- name: Checkout source
340-
if: steps.checksecrets.outputs.secretspresent == 'YES'
341-
uses: actions/checkout@v4
342-
with:
343-
fetch-depth: 0
344-
submodules: 'true'
345-
show-progress: 'false'
346-
- name: Install GitVersion
347-
if: steps.checksecrets.outputs.secretspresent == 'YES'
348-
uses: gittools/actions/gitversion/[email protected]
349-
with:
350-
versionSpec: '5.x'
351-
- name: Run GitVersion
352-
if: steps.checksecrets.outputs.secretspresent == 'YES'
353-
id: gitversion
354-
uses: gittools/actions/gitversion/[email protected]
355-
- name: Get Windows binaries
356-
if: steps.checksecrets.outputs.secretspresent == 'YES'
357-
uses: actions/download-artifact@master
358-
with:
359-
name: JabRef-windows
360-
path: build/distribution
361-
- name: Get macOS binaries unsigned
362-
if: (steps.checksecrets.outputs.secretspresent == 'YES') && (inputs.notarization == false && !startsWith(github.ref, 'refs/tags/'))
312+
- name: Download from GitHub workflow artifacts store (macOS)
313+
if: (steps.checksecrets.outputs.secretspresent == 'YES')
363314
uses: actions/download-artifact@master
364315
with:
365316
name: JabRef-macOS-tbn
366317
path: build/distribution/
367-
- name: Get macOS binaries notarized
368-
if: (steps.checksecrets.outputs.secretspresent == 'YES') && (inputs.notarization == true || startsWith(github.ref, 'refs/tags/'))
369-
uses: actions/download-artifact@master
370-
with:
371-
name: JabRef-macOS
372-
path: build/distribution/
373-
# Upload to build server using rsync
374-
# The action runs on linux only (because it is a Dockerized action), therefore it is embedded in a separate workflow
318+
- name: Notarize dmg
319+
if: (steps.checksecrets.outputs.secretspresent == 'YES')
320+
shell: bash
321+
run: |
322+
xcrun notarytool store-credentials "notarytool-profile" --apple-id "[email protected]" --team-id "6792V39SK3" --password "${{ secrets.OSX_NOTARIZATION_APP_PWD }}"
323+
xcrun notarytool submit build/distribution/JabRef-${{ needs.build.outputs.major }}.${{ needs.build.outputs.minor }}.dmg --keychain-profile "notarytool-profile" --wait
324+
xcrun stapler staple build/distribution/JabRef-${{ needs.build.outputs.major }}.${{ needs.build.outputs.minor }}.dmg
325+
- name: Notarize pkg
326+
if: (steps.checksecrets.outputs.secretspresent == 'YES')
327+
shell: bash
328+
run: |
329+
xcrun notarytool store-credentials "notarytool-profile" --apple-id "[email protected]" --team-id "6792V39SK3" --password "${{ secrets.OSX_NOTARIZATION_APP_PWD }}"
330+
xcrun notarytool submit build/distribution/JabRef-${{ needs.build.outputs.major }}.${{ needs.build.outputs.minor }}.pkg --keychain-profile "notarytool-profile" --wait
331+
xcrun stapler staple build/distribution/JabRef-${{ needs.build.outputs.major }}.${{ needs.build.outputs.minor }}.pkg
375332
- name: Upload to builds.jabref.org
376-
if: steps.checksecrets.outputs.secretspresent == 'YES'
377-
uses: Pendect/[email protected]
378-
env:
379-
DEPLOY_KEY: ${{ secrets.buildJabRefPrivateKey }}
380-
with:
381-
flags: -vaz --itemize-changes --stats --partial-dir=/tmp/partial --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync"
382-
options: ''
383-
ssh_options: '-p 9922'
384-
src: 'build/distribution/'
385-
dest: [email protected]:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/
386-
- name: Comment PR
387-
if: github.event_name == 'pull_request' && steps.checksecrets.outputs.secretspresent == 'YES'
388-
uses: thollander/actions-comment-pull-request@v2
389-
with:
390-
message: |
391-
The build of this PR is available at <https://builds.jabref.org/pull/${{ github.event.pull_request.number }}/merge>.
392-
comment_tag: download-link
393-
mode: recreate
333+
if: (steps.checksecrets.outputs.secretspresent == 'YES')
334+
shell: bash
335+
run: |
336+
echo "${{ secrets.buildJabRefPrivateKey }}" > sshkey
337+
chmod 600 sshkey
338+
rsync -rt --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --itemize-changes --stats --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ needs.build.outputs.branchname }} && rsync" -e 'ssh -p 9922 -i sshkey -o StrictHostKeyChecking=no' build/distribution/ [email protected]:/var/www/builds.jabref.org/www/${{ needs.build.outputs.branchname }}/

.github/workflows/refresh-journal-lists.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
cache: 'gradle'
4242
- name: Check whether journal-list.mv can be generated (the "real" generation is done inside JabRef's build process)
4343
run: |
44-
./gradlew generateJournalAbbreviationList
44+
./gradlew generateJournalListMV
4545
- uses: peter-evans/create-pull-request@v5
4646
with:
4747
token: ${{ secrets.GITHUB_TOKEN }}

build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,17 @@ tasks.register("generateSearchGrammarSource", JavaExec) {
323323
args = ["-o","src-gen/main/java/org/jabref/search" , "-visitor", "-no-listener", "-package", "org.jabref.search", "$projectDir/src/main/antlr4/org/jabref/search/Search.g4"]
324324
}
325325

326-
tasks.register("generateJournalAbbreviationList", JavaExec) {
326+
tasks.register("generateJournalListMV", JavaExec) {
327327
group = "JabRef"
328328
description = "Converts the comma-separated journal abbreviation file to a H2 MVStore"
329329
classpath = sourceSets.main.runtimeClasspath
330330
mainClass = "org.jabref.cli.JournalListMvGenerator"
331+
onlyIf {
332+
!file("build/resources/main/journals/journal-list.mv").exists()
333+
}
331334
}
332-
jar.dependsOn "generateJournalAbbreviationList"
333-
test.dependsOn "generateJournalAbbreviationList"
335+
jar.dependsOn "generateJournalListMV"
336+
compileTestJava.dependsOn "generateJournalListMV"
334337

335338
tasks.register('generateCitaviSource', XjcTask) {
336339
group = 'JabRef'
@@ -550,6 +553,7 @@ tasks.register('deleteInstallerTemp', Delete) {
550553
}
551554

552555
jpackage.dependsOn deleteInstallerTemp
556+
jlinkZip.dependsOn jpackage
553557
jlink {
554558
addOptions('--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages')
555559
launcher {

0 commit comments

Comments
 (0)