Skip to content

Commit 2743296

Browse files
authored
Merge branch 'JabRef:main' into fix-for-issue-10560
2 parents ef9bf12 + d94c9f4 commit 2743296

File tree

3 files changed

+220
-11
lines changed

3 files changed

+220
-11
lines changed
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# This workflow is a clone of "deployment.yml"
2+
# The difference is that this workflow uses JDK early access builds (jdk-ea) to check the build of JabRef
3+
# We separated this from the main workflow as we do not want to check on each PR if the JDK build, but only on main
4+
name: Deployment (JDK early access builds)
5+
6+
on:
7+
schedule:
8+
- cron: "0 5 * * 2"
9+
pull_request:
10+
paths:
11+
- .github/workflows/deployment-jdk-ea.yml
12+
workflow_dispatch:
13+
inputs:
14+
notarization:
15+
type: boolean
16+
required: false
17+
default: false
18+
19+
env:
20+
SpringerNatureAPIKey: ${{ secrets.SpringerNatureAPIKey }}
21+
AstrophysicsDataSystemAPIKey: ${{ secrets.AstrophysicsDataSystemAPIKey }}
22+
IEEEAPIKey: ${{ secrets.IEEEAPIKey }}
23+
BiodiversityHeritageApiKey: ${{ secrets.BiodiversityHeritageApiKey}}
24+
OSXCERT: ${{ secrets.OSX_SIGNING_CERT }}
25+
GRADLE_OPTS: -Xmx4g -Dorg.gradle.vfs.watch=false
26+
JAVA_OPTS: -Xmx4g
27+
28+
concurrency:
29+
group: "${{ github.workflow }}-${{ github.head_ref || github.ref }}"
30+
cancel-in-progress: true
31+
32+
jobs:
33+
build:
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
os: [ubuntu-latest, windows-latest, macos-latest]
38+
jdk: [22, 23]
39+
include:
40+
- os: ubuntu-latest
41+
displayName: linux
42+
archivePortable: tar -c -C build/distribution JabRef | pigz --rsyncable > build/distribution/JabRef-portable_linux.tar.gz && rm -R build/distribution/JabRef
43+
- os: windows-latest
44+
displayName: windows
45+
archivePortable: 7z a -r build/distribution/JabRef-portable_windows.zip ./build/distribution/JabRef && rm -R build/distribution/JabRef
46+
- os: macos-latest
47+
displayName: macOS
48+
archivePortable: brew install pigz && tar -c -C build/distribution JabRef.app | pigz --rsyncable > build/distribution/JabRef-portable_macos.tar.gz && rm -R build/distribution/JabRef.app
49+
runs-on: ${{ matrix.os }}
50+
outputs:
51+
major: ${{ steps.gitversion.outputs.Major }}
52+
minor: ${{ steps.gitversion.outputs.Minor }}
53+
branchname: ${{ steps.gitversion.outputs.branchName }}
54+
name: "JDK ${{ matrix.jdk }}: ${{ matrix.displayName }} installer and portable version"
55+
steps:
56+
- name: Check secrets presence
57+
id: checksecrets
58+
shell: bash
59+
run: |
60+
if [ "$BUILDJABREFPRIVATEKEY" == "" ]; then
61+
echo "secretspresent=NO" >> $GITHUB_OUTPUT
62+
else
63+
echo "secretspresent=YES" >> $GITHUB_OUTPUT
64+
fi
65+
env:
66+
BUILDJABREFPRIVATEKEY: ${{ secrets.buildJabRefPrivateKey }}
67+
- name: Fetch all history for all tags and branches
68+
uses: actions/checkout@v4
69+
with:
70+
fetch-depth: 0
71+
submodules: 'true'
72+
show-progress: 'false'
73+
- name: Install pigz and cache (linux)
74+
if: (matrix.os == 'ubuntu-latest')
75+
uses: awalsh128/cache-apt-pkgs-action@latest
76+
with:
77+
packages: pigz
78+
version: 1.0
79+
- name: Install GitVersion
80+
uses: gittools/actions/gitversion/[email protected]
81+
with:
82+
versionSpec: "5.x"
83+
- name: Run GitVersion
84+
id: gitversion
85+
uses: gittools/actions/gitversion/[email protected]
86+
- name: 'Set up JDK ${{ matrix.jdk }}'
87+
uses: oracle-actions/setup-java@v1
88+
with:
89+
website: jdk.java.net
90+
release: ${{ matrix.jdk }}
91+
version: latest
92+
- name: 'Set JDK${{ matrix.jdk }} env var'
93+
shell: bash
94+
run: echo "JDK${{ matrix.jdk }}=$JAVA_HOME" >> $GITHUB_ENV
95+
- name: 'Set JDK${{ matrix.jdk }} in toolchain (linux, Windows)'
96+
if: (matrix.os != 'macos-latest')
97+
shell: bash
98+
run: sed -i 's/JavaLanguageVersion.of(.*)/JavaLanguageVersion.of(${{ matrix.jdk }})/' build.gradle
99+
- name: 'Set JDK${{ matrix.jdk }} in toolchain (macOS)'
100+
if: (matrix.os == 'macos-latest')
101+
shell: bash
102+
run: sed -i'.bak' 's/JavaLanguageVersion.of(.*)/JavaLanguageVersion.of(${{ matrix.jdk }})/' build.gradle
103+
- name: Setup JDK
104+
uses: actions/setup-java@v4
105+
with:
106+
java-version: 21.0.2
107+
distribution: 'liberica'
108+
- name: Setup Gradle
109+
uses: gradle/actions/setup-gradle@v3
110+
- name: Prepare merged jars and modules dir (macOS)
111+
# prepareModulesDir is executing a build, which should run through even if no upload to builds.jabref.org is made
112+
if: (steps.checksecrets.outputs.secretspresent == 'NO')
113+
run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" prepareModulesDir
114+
- name: Setup macOS key chain
115+
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
116+
uses: apple-actions/import-codesign-certs@v2
117+
with:
118+
p12-file-base64: ${{ secrets.OSX_SIGNING_CERT }}
119+
p12-password: ${{ secrets.OSX_CERT_PWD }}
120+
keychain-password: jabref
121+
- name: Setup macOS key chain for app id cert
122+
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
123+
uses: apple-actions/import-codesign-certs@v2
124+
with:
125+
p12-file-base64: ${{ secrets.OSX_SIGNING_CERT_APPLICATION }}
126+
p12-password: ${{ secrets.OSX_CERT_PWD }}
127+
create-keychain: false
128+
keychain-password: jabref
129+
- name: Build runtime image and installer
130+
if: (steps.checksecrets.outputs.secretspresent == 'YES')
131+
shell: bash
132+
run: ./gradlew -i -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage jlinkZip
133+
- name: Package application image
134+
if: (steps.checksecrets.outputs.secretspresent == 'YES')
135+
shell: bash
136+
run: ${{ matrix.archivePortable }}
137+
- name: Rename files
138+
if: (matrix.os != 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
139+
shell: pwsh
140+
run: |
141+
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"}
142+
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"}
143+
- name: Repack deb file for Debian
144+
if: (matrix.os == 'ubuntu-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
145+
shell: bash
146+
run: |
147+
cd build/distribution
148+
ar x jabref_${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}_amd64.deb
149+
zstd -d < control.tar.zst | xz > control.tar.xz
150+
zstd -d < data.tar.zst | xz > data.tar.xz
151+
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
152+
rm debian-binary control.tar.* data.tar.*
153+
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
154+
- name: Rename files with JDK version
155+
shell: bash
156+
run: |
157+
for file in build/distribution/*.*; do
158+
base=${file%.*}
159+
ext=${file##*.}
160+
mv "$file" "${base}-jdk${{ matrix.jdk }}.${ext}"
161+
done
162+
- name: Setup rsync (macOS)
163+
if: (matrix.os == 'macos-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
164+
run: brew install rsync
165+
- name: Setup rsync (Windows)
166+
if: (matrix.os == 'windows-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
167+
# We want to have rsync available at this place to avoid uploading and downloading from GitHub artifact store (taking > 5 minutes in total)
168+
# We cannot use "action-rsyncer", because that requires Docker which is unavailable on Windows
169+
# We cannot use "setup-rsync", because that does not work on Windows
170+
# We do not use egor-tensin/setup-cygwin@v4, because it replaces the default shell
171+
run: choco install --no-progress rsync
172+
- name: Setup SSH key
173+
if: ${{ (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue')) && ((matrix.os != 'macos-latest') || !((startsWith(github.ref, 'refs/tags/') || (inputs.notarization == true)))) }}
174+
run: |
175+
echo "${{ secrets.buildJabRefPrivateKey }}" > sshkey
176+
chmod 600 sshkey
177+
- name: Upload to builds.jabref.org (Windows)
178+
if: (matrix.os == 'windows-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
179+
shell: cmd
180+
# for rsync installed by chocolatey, we need the ssh.exe delivered with that installation
181+
run: |
182+
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/jdk-ea && 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/jdk-ea/
183+
- name: Upload to builds.jabref.org (linux, macOS)
184+
if: (matrix.os != 'windows-latest') && (steps.checksecrets.outputs.secretspresent == 'YES') && (!startsWith(github.ref, 'refs/heads/gh-readonly-queue'))
185+
shell: bash
186+
run: |
187+
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/jdk-ea && rsync" -e 'ssh -p 9922 -i sshkey -o StrictHostKeyChecking=no' build/distribution/ [email protected]:/var/www/builds.jabref.org/www/jdk-ea/
188+
- name: Upload to GitHub workflow artifacts store
189+
if: (steps.checksecrets.outputs.secretspresent != 'YES')
190+
uses: actions/upload-artifact@v4
191+
with:
192+
name: JabRef-${{ matrix.os }}
193+
path: build/distribution
194+
compression-level: 0 # no compression
195+
announce:
196+
name: Comment on pull request
197+
runs-on: ubuntu-latest
198+
needs: [build]
199+
if: ${{ github.event_name == 'pull_request' }}
200+
steps:
201+
- name: Check secrets presence
202+
id: checksecrets
203+
shell: bash
204+
run: |
205+
if [ "$BUILDJABREFPRIVATEKEY" == "" ]; then
206+
echo "secretspresent=NO" >> $GITHUB_OUTPUT
207+
else
208+
echo "secretspresent=YES" >> $GITHUB_OUTPUT
209+
fi
210+
env:
211+
BUILDJABREFPRIVATEKEY: ${{ secrets.buildJabRefPrivateKey }}
212+
- name: Comment PR
213+
if: (steps.checksecrets.outputs.secretspresent == 'YES')
214+
uses: thollander/actions-comment-pull-request@v2
215+
with:
216+
message: |
217+
The build of this PR is available at <https://builds.jabref.org/pull/${{ github.event.pull_request.number }}/merge>.
218+
comment_tag: download-link
219+
mode: recreate

.github/workflows/deployment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ jobs:
227227
if: (steps.checksecrets.outputs.secretspresent != 'YES')
228228
uses: actions/upload-artifact@v4
229229
with:
230-
# tbn = to-be-notarized
231230
name: JabRef-${{ matrix.os }}
232231
path: build/distribution
233232
compression-level: 0 # no compression

settings.gradle

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
pluginManagement {
2-
repositories {
3-
maven {
4-
url 'https://oss.sonatype.org/content/repositories/snapshots'
5-
}
6-
gradlePluginPortal()
7-
}
8-
}
9-
101
plugins {
11-
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
2+
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
123
}
134

145
rootProject.name = "JabRef"

0 commit comments

Comments
 (0)