|
| 1 | +name: Deployment |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +jobs: |
| 6 | + deploy: |
| 7 | + strategy: |
| 8 | + fail-fast: false |
| 9 | + matrix: |
| 10 | + os: [ubuntu-latest, windows-latest, macOS-latest] |
| 11 | + include: |
| 12 | + - os: ubuntu-latest |
| 13 | + displayName: linux |
| 14 | + jpackageDownload: https://download.java.net/java/early_access/jpackage/1/openjdk-14-jpackage+1-35_linux-x64_bin.tar.gz |
| 15 | + jdk14Path: /jdk-14 |
| 16 | + archivePortable: tar -czf build/distribution/JabRef-portable_linux.tar.gz -C build/distribution JabRef && rm -R build/distribution/JabRef |
| 17 | + - os: windows-latest |
| 18 | + displayName: windows |
| 19 | + jpackageDownload: https://download.java.net/java/early_access/jpackage/1/openjdk-14-jpackage+1-35_windows-x64_bin.zip |
| 20 | + jdk14Path: /jdk-14 |
| 21 | + archivePortable: 7z a -r build/distribution/JabRef-portable_windows.zip build/distribution/JabRef/ && rm -R build/distribution/JabRef |
| 22 | + - os: macOS-latest |
| 23 | + displayName: macOS |
| 24 | + jpackageDownload: https://download.java.net/java/early_access/jpackage/1/openjdk-14-jpackage+1-35_osx-x64_bin.tar.gz |
| 25 | + 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 |
| 27 | + |
| 28 | + runs-on: ${{ matrix.os }} |
| 29 | + name: Deploy on ${{ matrix.displayName }} |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout source |
| 33 | + uses: actions/checkout@v1 |
| 34 | + - name: Set up JDK |
| 35 | + uses: actions/setup-java@v1 |
| 36 | + with: |
| 37 | + java-version: 11.0.4 |
| 38 | + - name: Download jpackage |
| 39 | + # We need to download jpackage from https://jdk.java.net/jpackage/ |
| 40 | + run: | |
| 41 | + import tarfile |
| 42 | + import zipfile |
| 43 | + import sys |
| 44 | + if sys.version_info[0] >= 3: |
| 45 | + from urllib.request import urlretrieve |
| 46 | + else: |
| 47 | + from urllib import urlretrieve |
| 48 | +
|
| 49 | + url = "${{ matrix.jpackageDownload }}" |
| 50 | + tmpfile, headers = urlretrieve(url) |
| 51 | + if (url.endswith("tar.gz")): |
| 52 | + tar = tarfile.open(tmpfile) |
| 53 | + tar.extractall() |
| 54 | + tar.close() |
| 55 | + elif (url.endswith("zip")): |
| 56 | + zip = zipfile.ZipFile(tmpfile) |
| 57 | + zip.extractall() |
| 58 | + zip.close() |
| 59 | + shell: python |
| 60 | + - name: Build runtime image |
| 61 | + run: ./gradlew -Pdev=true jlinkZip |
| 62 | + - name: Build installer |
| 63 | + run: | |
| 64 | + export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}" |
| 65 | + ./gradlew -Pdev=true jpackage |
| 66 | + shell: bash |
| 67 | + - name: Add installer as artifact |
| 68 | + uses: actions/upload-artifact@master |
| 69 | + with: |
| 70 | + name: JabRef-${{ matrix.displayName }} |
| 71 | + path: build/distribution |
| 72 | + - name: Package application image |
| 73 | + run: ${{ matrix.archivePortable }} |
| 74 | + shell: bash |
| 75 | + - name: Extract branch name |
| 76 | + shell: bash |
| 77 | + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" |
| 78 | + id: extract_branch |
| 79 | + - name: Upload to builds.jabref.org |
| 80 | + uses: garygrossgarten/github-action-scp@release |
| 81 | + with: |
| 82 | + local: build/distribution |
| 83 | + remote: www/${{ steps.extract_branch.outputs.branch }} |
| 84 | + host: builds.jabref.org |
| 85 | + username: builds_jabref_org |
| 86 | + privateKey: ${{ secrets.buildJabRefPrivateKey }} |
| 87 | + port: 9922 |
0 commit comments