@@ -3,17 +3,17 @@ name: Deployment
33on : [push]
44
55jobs :
6- deploy :
6+ build :
77 strategy :
8- fail-fast : false
8+ fail-fast : true
99 matrix :
1010 os : [ubuntu-latest, windows-latest, macOS-latest]
1111 include :
1212 - os : ubuntu-latest
1313 displayName : linux
1414 jpackageDownload : https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_linux-x64_bin.tar.gz
1515 jdk14Path : /jdk-14
16- archivePortable : tar -czf build/distribution/ JabRef-portable_linux.tar.gz -C build/distribution JabRef && rm -R build/distribution/JabRef
16+ archivePortable : tar -c -C build/distribution JabRef | pigz --rsyncable > build/distribution/ JabRef-portable_linux.tar.gz && rm -R build/distribution/JabRef
1717 - os : windows-latest
1818 displayName : windows
1919 jpackageDownload : https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_windows-x64_bin.zip
@@ -23,104 +23,150 @@ jobs:
2323 displayName : macOS
2424 jpackageDownload : https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_osx-x64_bin.tar.gz
2525 jdk14Path : /jdk-14.jdk/Contents/Home
26- archivePortable : tar -czf build/distribution/ JabRef-portable_macos.tar.gz -C build/distribution JabRef.app && rm -R build/distribution/JabRef.app
26+ 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
2727
2828 runs-on : ${{ matrix.os }}
29- name : Deploy on ${{ matrix.displayName }}
29+ name : Create installer and portable version for ${{ matrix.displayName }}
3030
3131 steps :
32- - name : Checkout source
33- uses : actions/checkout@v2-beta
34- with :
35- fetch-depth : 0
36- - name : Fetch tags and master for GitVersion
37- run : |
38- git fetch --tags origin
39- git rev-parse --verify master
40- if (-not $?) {
41- git branch --force --create-reflog master origin/master
42- }
43- shell : pwsh
44- - name : Install GitVersion
45- uses :
gittools/actions/[email protected] 46- with :
47- versionSpec : ' 5.1.2'
48- - name : Run GitVersion
49- id : gitversion
50- uses :
gittools/actions/[email protected] 51- - name : Set up JDK
52- uses : actions/setup-java@v1
53- with :
54- java-version : 13
55- - uses : actions/cache@v1
56- with :
57- path : ~/.gradle/caches
58- key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
59- restore-keys : |
60- ${{ runner.OS }}-gradle-${{ env.cache-name }}-
61- ${{ runner.OS }}-gradle-
62- ${{ runner.OS }}-
63- - uses : actions/cache@v1
64- name : Cache gradle wrapper
65- with :
66- path : ~/.gradle/wrapper
67- key : ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
68- - name : Download jpackage
69- # We need to download jpackage from https://jdk.java.net/jpackage/
70- run : |
71- import tarfile
72- import zipfile
73- import sys
74- if sys.version_info[0] >= 3:
75- from urllib.request import urlretrieve
76- else:
77- from urllib import urlretrieve
32+ - name : Checkout source
33+ uses : actions/checkout@v2-beta
34+ with :
35+ fetch-depth : 0
36+ - name : Fetch tags and master for GitVersion
37+ run : |
38+ git fetch --tags origin
39+ git rev-parse --verify master
40+ if (-not $?) {
41+ git branch --force --create-reflog master origin/master
42+ }
43+ shell : pwsh
44+ - name : Install GitVersion
45+ uses :
gittools/actions/[email protected] 46+ with :
47+ versionSpec : ' 5.1.2'
48+ - name : Run GitVersion
49+ id : gitversion
50+ uses :
gittools/actions/[email protected] 51+ - name : Set up JDK
52+ uses : actions/setup-java@v1
53+ with :
54+ java-version : 13
55+ # configuration based on https://github.com/actions/cache/blob/master/examples.md#java---gradle
56+ - uses : actions/cache@v1
57+ name : Restore gradle cache
58+ with :
59+ path : ~/.gradle/caches
60+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
61+ restore-keys : |
62+ ${{ runner.OS }}-gradle-${{ env.cache-name }}-
63+ ${{ runner.OS }}-gradle-
64+ ${{ runner.OS }}-
65+ - uses : actions/cache@v1
66+ name : Cache gradle wrapper
67+ # cache at Mac OS X is 2 GB (too large)
68+ if : matrix.displayName == 'linux' || matrix.displayName == 'windows'
69+ with :
70+ path : ~/.gradle/wrapper
71+ key : ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
72+ - name : Download jpackage
73+ # We need to download jpackage from https://jdk.java.net/jpackage/
74+ run : |
75+ import tarfile
76+ import zipfile
77+ import sys
78+ if sys.version_info[0] >= 3:
79+ from urllib.request import urlretrieve
80+ else:
81+ from urllib import urlretrieve
7882
79- url = "${{ matrix.jpackageDownload }}"
80- tmpfile, headers = urlretrieve(url)
81- if (url.endswith("tar.gz")):
82- tar = tarfile.open(tmpfile)
83- tar.extractall()
84- tar.close()
85- elif (url.endswith("zip")):
86- zip = zipfile.ZipFile(tmpfile)
87- zip.extractall()
88- zip.close()
89- shell : python
90- - name : Build runtime image
91- run : ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip
92- - name : Build installer
93- run : |
94- export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}"
95- ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage
96- shell : bash
97- - name : Package application image
98- run : ${{ matrix.archivePortable }}
99- shell : bash
100- - name : Build and publish snap
101- if : matrix.os == 'ubuntu-latest' && steps.gitversion.outputs.branchName == 'master'
102- env :
103- SNAPCRAFT_LOGIN_FILE : ${{ secrets.SNAPCRAFT_LOGIN_FILE }}
104- run : |
105- mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
106- docker run -v $(pwd):$(pwd) -t lyzardking/snapcraft-bionic sh -c "apt update -qq && cd $(pwd) && snapcraft && mv jabref*.snap build/distribution/ && snapcraft push build/distribution/jabref*.snap --release edge || true"
107- shell : bash
108- - name : Rename files
109- run : |
110- get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"}
111- get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"}
112- shell : pwsh
113- - name : Upload to GitHub workflow artifacts store
114- uses : actions/upload-artifact@master
115- with :
116- name : JabRef-${{ matrix.displayName }}
117- path : build/distribution
118- - name : Upload to builds.jabref.org
119- uses : garygrossgarten/github-action-scp@release
120- with :
121- local : build/distribution
122- remote : www/${{ steps.gitversion.outputs.branchName }}
123- host : builds.jabref.org
124- username : builds_jabref_org
125- privateKey : ${{ secrets.buildJabRefPrivateKey }}
126- port : 9922
83+ url = "${{ matrix.jpackageDownload }}"
84+ tmpfile, headers = urlretrieve(url)
85+ if (url.endswith("tar.gz")):
86+ tar = tarfile.open(tmpfile)
87+ tar.extractall()
88+ tar.close()
89+ elif (url.endswith("zip")):
90+ zip = zipfile.ZipFile(tmpfile)
91+ zip.extractall()
92+ zip.close()
93+ shell : python
94+ - name : Build runtime image
95+ run : ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip
96+ - name : Build installer
97+ run : |
98+ export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}"
99+ ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage
100+ shell : bash
101+ - name : Package application image
102+ run : ${{ matrix.archivePortable }}
103+ shell : bash
104+ - name : Build and publish snap
105+ if : matrix.displayName == 'linux' && github.ref == 'refs/heads/master'
106+ env :
107+ SNAPCRAFT_LOGIN_FILE : ${{ secrets.SNAPCRAFT_LOGIN_FILE }}
108+ run : |
109+ mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
110+ docker run -v $(pwd):$(pwd) -t lyzardking/snapcraft-bionic sh -c "apt update -qq && cd $(pwd) && snapcraft && mv jabref*.snap build/distribution/ && snapcraft push build/distribution/jabref*.snap --release edge || true"
111+ shell : bash
112+ - name : Rename files
113+ run : |
114+ get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"}
115+ get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"}
116+ shell : pwsh
117+ - name : Upload to GitHub workflow artifacts store
118+ uses : actions/upload-artifact@master
119+ with :
120+ name : JabRef-${{ matrix.displayName }}
121+ path : build/distribution
122+ deploy :
123+ name : Deploy binaries on builds.jabref.org
124+ runs-on : ubuntu-latest
125+ needs : [build]
126+ steps :
127+ - name : Checkout source
128+ uses : actions/checkout@v2-beta
129+ with :
130+ fetch-depth : 0
131+ - name : Fetch tags and master for GitVersion
132+ run : |
133+ git fetch --tags origin
134+ git rev-parse --verify master
135+ if (-not $?) {
136+ git branch --force --create-reflog master origin/master
137+ }
138+ shell : pwsh
139+ - name : Install GitVersion
140+ uses :
gittools/actions/[email protected] 141+ with :
142+ versionSpec : ' 5.1.2'
143+ - name : Run GitVersion
144+ id : gitversion
145+ uses :
gittools/actions/[email protected] 146+ - name : Get linux binaries
147+ uses : actions/download-artifact@master
148+ with :
149+ name : JabRef-linux
150+ path : build/distribution
151+ - name : Get windows binaries
152+ uses : actions/download-artifact@master
153+ with :
154+ name : JabRef-windows
155+ path : build/distribution
156+ - name : Get macOS binaries
157+ uses : actions/download-artifact@master
158+ with :
159+ name : JabRef-macOS
160+ path : build/distribution/
161+ - name : Deploy to builds.jabref.org
162+ id : deploy
163+ 164+ env :
165+ DEPLOY_KEY : ${{ secrets.buildJabRefPrivateKey }}
166+ BRANCH : ${{ steps.gitversion.outputs.branchName }}
167+ with :
168+ flags : -vaz --itemize-changes --stats --partial-dir=/tmp/partial --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync"
169+ options : ' '
170+ ssh_options : ' -p 9922'
171+ src : ' build/distribution/'
172+ dest :
[email protected] :/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/
0 commit comments