From 083d0cfbc486f78c7e9c7312672c913cb3e9eb48 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 22 Nov 2022 14:51:12 +0100 Subject: [PATCH] migrate windows build to use get-version workflow --- .github/workflows/win-exe.yml | 61 +++++++++++------------------------ 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/.github/workflows/win-exe.yml b/.github/workflows/win-exe.yml index 332e1e725..3fdea0c43 100644 --- a/.github/workflows/win-exe.yml +++ b/.github/workflows/win-exe.yml @@ -19,52 +19,27 @@ defaults: shell: bash jobs: + get-version: + uses: ./.github/workflows/get-version.yml + with: + version: ${{ github.event.inputs.version }} + build-msi: name: Build .msi Installer runs-on: windows-latest + needs: [get-version] env: LOOPBACK_ALIAS: 'cryptomator-vault' - outputs: - semVerNum: ${{ steps.versions.outputs.semVerNum }} - semVerStr: ${{ steps.versions.outputs.semVerStr }} - revNum: ${{ steps.versions.outputs.revNum }} - isProductionVersion: ${{ steps.versions.outputs.isProductionVersion}} steps: - uses: actions/checkout@v3 - with: - fetch-depth: 0 - name: Setup Java uses: actions/setup-java@v3 with: distribution: ${{ env.JAVA_DIST }} java-version: ${{ env.JAVA_VERSION }} cache: ${{ env.JAVA_CACHE }} - - id: versions - name: Apply version information - run: | - if [[ $GITHUB_REF =~ refs/tags/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then - SEM_VER_STR=${GITHUB_REF##*/} - mvn versions:set -DnewVersion=${SEM_VER_STR} - elif [[ "${{ github.event.inputs.version }}" =~ [0-9]+\.[0-9]+\.[0-9]+.* ]]; then - SEM_VER_STR="${{ github.event.inputs.version }}" - mvn versions:set -DnewVersion=${SEM_VER_STR} - else - SEM_VER_STR=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout` - fi - SEM_VER_NUM=`echo ${SEM_VER_STR} | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/'` - REVCOUNT=`git rev-list --count HEAD` - PRODUCTION_READY_VERSION="false" - if [[ $SEM_VER_STR =~ [0-9]+\.[0-9].[0-9]+ ]]; then - PRODUCTION_READY_VERSION="true" - fi - echo "::set-output name=semVerStr::${SEM_VER_STR}" - echo "::set-output name=semVerNum::${SEM_VER_NUM}" - echo "::set-output name=revNum::${REVCOUNT}" - echo "::set-output name=isProductionVersion::${PRODUCTION_READY_VERSION}" - - name: Validate Version - uses: skymatic/semver-validation-action@v1 - with: - version: ${{ steps.versions.outputs.semVerStr }} + - name: Set version + run : mvn versions:set -DnewVersion=${{ needs.get-version.outputs.semVerStr }} - name: Run maven run: mvn -B clean package -Pdependency-check,win -DskipTests - name: Patch target dir @@ -97,10 +72,10 @@ jobs: --name Cryptomator --vendor "Skymatic GmbH" --copyright "(C) 2016 - 2022 Skymatic GmbH" - --app-version "${{ steps.versions.outputs.semVerNum }}.${{ steps.versions.outputs.revNum }}" + --app-version "${{ needs.get-version.outputs.semVerNum }}.${{ needs.get-version.outputs.revNum }}" --java-options "-Xss5m" --java-options "-Xmx256m" - --java-options "-Dcryptomator.appVersion=\"${{ steps.versions.outputs.semVerStr }}\"" + --java-options "-Dcryptomator.appVersion=\"${{ needs.get-version.outputs.semVerStr }}\"" --java-options "-Dfile.encoding=\"utf-8\"" --java-options "-Dcryptomator.logDir=\"~/AppData/Roaming/Cryptomator\"" --java-options "-Dcryptomator.pluginDir=\"~/AppData/Roaming/Cryptomator/Plugins\"" @@ -110,7 +85,7 @@ jobs: --java-options "-Dcryptomator.mountPointsDir=\"~/Cryptomator\"" --java-options "-Dcryptomator.loopbackAlias=\"${{ env.LOOPBACK_ALIAS }}\"" --java-options "-Dcryptomator.showTrayIcon=true" - --java-options "-Dcryptomator.buildNumber=\"msi-${{ steps.versions.outputs.revNum }}\"" + --java-options "-Dcryptomator.buildNumber=\"msi-${{ needs.get-version.outputs.revNum }}\"" --java-options "-Dcryptomator.integrationsWin.autoStartShellLinkName=\"Cryptomator\"" --java-options "-Dcryptomator.integrationsWin.keychainPaths=\"~/AppData/Roaming/Cryptomator/keychain.json\"" --resource-dir dist/win/resources @@ -163,7 +138,7 @@ jobs: --name Cryptomator --vendor "Skymatic GmbH" --copyright "(C) 2016 - 2022 Skymatic GmbH" - --app-version "${{ steps.versions.outputs.semVerNum }}" + --app-version "${{ needs.get-version.outputs.semVerNum }}" --win-menu --win-dir-chooser --win-shortcut-prompt @@ -184,7 +159,7 @@ jobs: timestampUrl: 'http://timestamp.digicert.com' folder: installer - name: Add possible alpha/beta tags to installer name - run: mv installer/Cryptomator-*.msi Cryptomator-${{ steps.versions.outputs.semVerStr }}-x64.msi + run: mv installer/Cryptomator-*.msi Cryptomator-${{ needs.get-version.outputs.semVerStr }}-x64.msi - name: Create detached GPG signature with key 615D449FE6E6A235 run: | echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import @@ -211,8 +186,8 @@ jobs: *.asc call-winget-flow: - needs: [build-msi] - if: github.event.action == 'published' && needs.build-msi.outputs.isProductionVersion + needs: [get-version, build-msi] + if: github.event.action == 'published' && needs.get-version.outputs.type == 'stable' uses: ./.github/workflows/winget.yml with: releaseTag: ${{ github.event.release.tag_name }} @@ -222,7 +197,7 @@ jobs: build-exe: name: Build .exe installer runs-on: windows-latest - needs: [build-msi] + needs: [version, build-msi] steps: - uses: actions/checkout@v3 - name: Download .msi @@ -258,7 +233,7 @@ jobs: "${WIX}/bin/candle.exe" dist/win/bundle/bundleWithWinfsp.wxs -ext WixBalExtension -out dist/win/bundle/ - -dBundleVersion="${{ needs.build-msi.outputs.semVerNum }}.${{ needs.build-msi.outputs.revNum }}" + -dBundleVersion="${{ needs.get-version.outputs.semVerNum }}.${{ needs.get-version.outputs.revNum }}" -dBundleVendor="Skymatic GmbH" -dBundleCopyright="(C) 2016 - 2022 Skymatic GmbH" -dAboutUrl="https://cryptomator.org" @@ -298,7 +273,7 @@ jobs: timestampUrl: 'http://timestamp.digicert.com' folder: installer - name: Add possible alpha/beta tags to installer name - run: mv installer/Cryptomator-Installer.exe Cryptomator-${{ needs.build-msi.outputs.semVerStr }}-x64.exe + run: mv installer/Cryptomator-Installer.exe Cryptomator-${{ needs.get-version.outputs.semVerStr }}-x64.exe - name: Create detached GPG signature with key 615D449FE6E6A235 run: | echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import