|
| 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-49_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-49_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-49_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 | + with: |
| 35 | + depth: 1 |
| 36 | + submodules: true |
| 37 | + - name: Extract branch name |
| 38 | + shell: bash |
| 39 | + run: | |
| 40 | + ref=${GITHUB_REF#refs/heads/} |
| 41 | + ref=${ref#refs/pull/} |
| 42 | + ref=${ref%/merge} |
| 43 | + echo "##[set-output name=branch;]${ref}" |
| 44 | + id: extract_branch |
| 45 | + - name: Set up JDK |
| 46 | + uses: actions/setup-java@v1 |
| 47 | + with: |
| 48 | + java-version: 12.0.2 |
| 49 | + - name: Download jpackage |
| 50 | + # We need to download jpackage from https://jdk.java.net/jpackage/ |
| 51 | + run: | |
| 52 | + import tarfile |
| 53 | + import zipfile |
| 54 | + import sys |
| 55 | + if sys.version_info[0] >= 3: |
| 56 | + from urllib.request import urlretrieve |
| 57 | + else: |
| 58 | + from urllib import urlretrieve |
| 59 | +
|
| 60 | + url = "${{ matrix.jpackageDownload }}" |
| 61 | + tmpfile, headers = urlretrieve(url) |
| 62 | + if (url.endswith("tar.gz")): |
| 63 | + tar = tarfile.open(tmpfile) |
| 64 | + tar.extractall() |
| 65 | + tar.close() |
| 66 | + elif (url.endswith("zip")): |
| 67 | + zip = zipfile.ZipFile(tmpfile) |
| 68 | + zip.extractall() |
| 69 | + zip.close() |
| 70 | + shell: python |
| 71 | + - name: Build runtime image |
| 72 | + run: ./gradlew -Pdev=true jlinkZip |
| 73 | + - name: Build installer |
| 74 | + run: | |
| 75 | + export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}" |
| 76 | + ./gradlew -Pdev=true jpackage |
| 77 | + shell: bash |
| 78 | + - name: Add installer as artifact |
| 79 | + uses: actions/upload-artifact@master |
| 80 | + with: |
| 81 | + name: JabRef-${{ matrix.displayName }} |
| 82 | + path: build/distribution |
| 83 | + - name: Package application image |
| 84 | + run: ${{ matrix.archivePortable }} |
| 85 | + shell: bash |
| 86 | + - name: Build and publish snap |
| 87 | + if: matrix.os == 'ubuntu-latest' && steps.extract_branch.outputs.branch == 'master' |
| 88 | + env: |
| 89 | + SNAPCRAFT_LOGIN_FILE: ${{ secrets.SNAPCRAFT_LOGIN_FILE }} |
| 90 | + run: | |
| 91 | + mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg |
| 92 | + 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" |
| 93 | + shell: bash |
| 94 | + - name: Upload to builds.jabref.org |
| 95 | + uses: garygrossgarten/github-action-scp@release |
| 96 | + with: |
| 97 | + local: build/distribution |
| 98 | + remote: www/${{ steps.extract_branch.outputs.branch }} |
| 99 | + host: builds.jabref.org |
| 100 | + username: builds_jabref_org |
| 101 | + privateKey: ${{ secrets.buildJabRefPrivateKey }} |
| 102 | + port: 9922 |
0 commit comments