diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index b29884f77bb..95b4f6f30c8 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -29,96 +29,96 @@ jobs: name: Create installer and portable version for ${{ matrix.displayName }} steps: - - name: Checkout source - uses: actions/checkout@v2-beta - with: - fetch-depth: 0 - - name: Fetch tags and master for GitVersion - run: | - git fetch --tags origin - git rev-parse --verify master - if (-not $?) { - git branch --force --create-reflog master origin/master - } - shell: pwsh - - name: Install GitVersion - uses: gittools/actions/setup-gitversion@v0.3 - with: - versionSpec: '5.1.2' - - name: Run GitVersion - id: gitversion - uses: gittools/actions/execute-gitversion@v0.3 - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: 13 - # configuration based on https://github.com/actions/cache/blob/master/examples.md#java---gradle - - uses: actions/cache@v1 - name: Restore gradle cache - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: | - ${{ runner.OS }}-gradle-${{ env.cache-name }}- - ${{ runner.OS }}-gradle- - ${{ runner.OS }}- - - uses: actions/cache@v1 - name: Cache gradle wrapper - # cache at Mac OS X is 2 GB (too large) - if: matrix.displayName == 'linux' || matrix.displayName == 'windows' - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - name: Download jpackage - # We need to download jpackage from https://jdk.java.net/jpackage/ - run: | - import tarfile - import zipfile - import sys - if sys.version_info[0] >= 3: - from urllib.request import urlretrieve - else: - from urllib import urlretrieve + - name: Checkout source + uses: actions/checkout@v2-beta + with: + fetch-depth: 0 + - name: Fetch tags and master for GitVersion + run: | + git fetch --tags origin + git rev-parse --verify master + if (-not $?) { + git branch --force --create-reflog master origin/master + } + shell: pwsh + - name: Install GitVersion + uses: gittools/actions/setup-gitversion@v0.3 + with: + versionSpec: '5.1.2' + - name: Run GitVersion + id: gitversion + uses: gittools/actions/execute-gitversion@v0.3 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 13 + # configuration based on https://github.com/actions/cache/blob/master/examples.md#java---gradle + - uses: actions/cache@v1 + name: Restore gradle cache + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: | + ${{ runner.OS }}-gradle-${{ env.cache-name }}- + ${{ runner.OS }}-gradle- + ${{ runner.OS }}- + - uses: actions/cache@v1 + name: Cache gradle wrapper + # cache at Mac OS X is 2 GB (too large) + if: matrix.displayName == 'linux' || matrix.displayName == 'windows' + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + - name: Download jpackage + # We need to download jpackage from https://jdk.java.net/jpackage/ + run: | + import tarfile + import zipfile + import sys + if sys.version_info[0] >= 3: + from urllib.request import urlretrieve + else: + from urllib import urlretrieve - url = "${{ matrix.jpackageDownload }}" - tmpfile, headers = urlretrieve(url) - if (url.endswith("tar.gz")): - tar = tarfile.open(tmpfile) - tar.extractall() - tar.close() - elif (url.endswith("zip")): - zip = zipfile.ZipFile(tmpfile) - zip.extractall() - zip.close() - shell: python - - name: Build runtime image - run: ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip - - name: Build installer - run: | - export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}" - ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage - shell: bash - - name: Package application image - run: ${{ matrix.archivePortable }} - shell: bash - - name: Build and publish snap - if: matrix.displayName == 'linux' && github.ref == 'refs/heads/master' - env: - SNAPCRAFT_LOGIN_FILE: ${{ secrets.SNAPCRAFT_LOGIN_FILE }} - run: | - mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg - 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" - shell: bash - - name: Rename files - run: | - get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"} - get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"} - shell: pwsh - - name: Upload to GitHub workflow artifacts store - uses: actions/upload-artifact@master - with: - name: JabRef-${{ matrix.displayName }} - path: build/distribution + url = "${{ matrix.jpackageDownload }}" + tmpfile, headers = urlretrieve(url) + if (url.endswith("tar.gz")): + tar = tarfile.open(tmpfile) + tar.extractall() + tar.close() + elif (url.endswith("zip")): + zip = zipfile.ZipFile(tmpfile) + zip.extractall() + zip.close() + shell: python + - name: Build runtime image + run: ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip + - name: Build installer + run: | + export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}" + ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage + shell: bash + - name: Package application image + run: ${{ matrix.archivePortable }} + shell: bash + - name: Build and publish snap + if: matrix.displayName == 'linux' && github.ref == 'refs/heads/master' + env: + SNAPCRAFT_LOGIN_FILE: ${{ secrets.SNAPCRAFT_LOGIN_FILE }} + run: | + mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg + 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" + shell: bash + - name: Rename files + run: | + get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"} + get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"} + shell: pwsh + - name: Upload to GitHub workflow artifacts store + uses: actions/upload-artifact@master + with: + name: JabRef-${{ matrix.displayName }} + path: build/distribution deploy: name: Deploy binaries on builds.jabref.org runs-on: ubuntu-latest