diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0e1f598be..2ffc3070e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,11 @@ name: Build on: push: + pull_request_target: + types: [labeled] env: - JAVA_VERSION: 16 + JAVA_VERSION: 17 defaults: run: @@ -17,19 +19,16 @@ jobs: if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" steps: - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v2 with: + distribution: 'temurin' java-version: ${{ env.JAVA_VERSION }} - - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- + cache: 'maven' - name: Build and Test run: mvn -B clean install jacoco:report -Pcoverage,dependency-check - name: Upload code coverage report id: codacyCoverageReporter + if: "github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'pr:safe')" run: bash <(curl -Ls https://coverage.codacy.com/get.sh) env: CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml new file mode 100644 index 000000000..c529ca09b --- /dev/null +++ b/.github/workflows/pullrequest.yml @@ -0,0 +1,26 @@ +name: Pull Request + +on: + pull_request: + +env: + JAVA_VERSION: 17 + +defaults: + run: + shell: bash + +jobs: + test: + name: Compile and Test + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: ${{ env.JAVA_VERSION }} + cache: 'maven' + - name: Build and Test + run: mvn -B clean install jacoco:report -Pcoverage,dependency-check \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c3e254426..03d913c91 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,13 +2,18 @@ name: Installers and Release on: workflow_dispatch: + inputs: + semver: + description: 'SemVer' + required: true + default: '0.99.99-SNAPSHOT' push: tags: # see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - '[0-9]+.[0-9]+.[0-9]+' - '[0-9]+.[0-9]+.[0-9]+-*' env: - JAVA_VERSION: 16 + JAVA_VERSION: 17 defaults: run: @@ -61,7 +66,7 @@ jobs: target/libs target/mods target/LICENSE.txt - target/${{ matrix.launcher }} + target/launcher* if-no-files-found: error # @@ -71,8 +76,9 @@ jobs: name: Determine Version Metadata runs-on: ubuntu-latest outputs: - versionStr: ${{ steps.versions.outputs.versionStr }} - versionNum: ${{ steps.versions.outputs.versionNum }} + semVerNum: ${{ steps.versions.outputs.semVerNum }} + semVerStr: ${{ steps.versions.outputs.semVerStr }} + ppaVerStr: ${{ steps.versions.outputs.ppaVerStr }} revNum: ${{ steps.versions.outputs.revNum }} steps: - uses: actions/checkout@v2 @@ -81,14 +87,19 @@ jobs: - id: versions run: | if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION_NUM=`echo ${GITHUB_REF##*/} | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/'` - echo "::set-output name=versionStr::${GITHUB_REF##*/}" - echo "::set-output name=versionNum::${VERSION_NUM}" + SEM_VER_STR=${GITHUB_REF##*/} else - echo "::set-output name=versionStr::SNAPSHOT" - echo "::set-output name=versionNum::99.0.0" + SEM_VER_STR=${{ github.event.inputs.semver }} fi - echo "::set-output name=revNum::`git rev-list --count HEAD`" + SEM_VER_NUM=`echo ${SEM_VER_STR} | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/'` + REVCOUNT=`git rev-list --count HEAD` + echo "::set-output name=semVerStr::${SEM_VER_STR}" + echo "::set-output name=semVerNum::${SEM_VER_NUM}" + echo "::set-output name=ppaVerStr::${SEM_VER_STR/-/\~}-${REVCOUNT}" + echo "::set-output name=revNum::${REVCOUNT}" + - uses: skymatic/semver-validation-action@v1 + with: + version: ${{ steps.versions.outputs.semVerStr }} # # Application Directory @@ -104,9 +115,10 @@ jobs: - os: ubuntu-latest profile: linux jpackageoptions: > - --app-version "${{ needs.metadata.outputs.versionNum }}.${{ needs.metadata.outputs.revNum }}" + --app-version "${{ needs.metadata.outputs.semVerNum }}.${{ needs.metadata.outputs.revNum }}" --java-options "-Dfile.encoding=\"utf-8\"" --java-options "-Dcryptomator.logDir=\"~/.local/share/Cryptomator/logs\"" + --java-options "-Dcryptomator.pluginDir=\"~/.local/share/Cryptomator/plugins\"" --java-options "-Dcryptomator.settingsPath=\"~/.config/Cryptomator/settings.json:~/.Cryptomator/settings.json\"" --java-options "-Dcryptomator.ipcSocketPath=\"~/.config/Cryptomator/ipc.socket\"" --java-options "-Dcryptomator.mountPointsDir=\"~/.local/share/Cryptomator/mnt\"" @@ -116,9 +128,10 @@ jobs: - os: windows-latest profile: win jpackageoptions: > - --app-version "${{ needs.metadata.outputs.versionNum }}.${{ needs.metadata.outputs.revNum }}" + --app-version "${{ needs.metadata.outputs.semVerNum }}.${{ needs.metadata.outputs.revNum }}" --java-options "-Dfile.encoding=\"utf-8\"" --java-options "-Dcryptomator.logDir=\"~/AppData/Roaming/Cryptomator\"" + --java-options "-Dcryptomator.pluginDir=\"~/AppData/Roaming/Cryptomator/Plugins\"" --java-options "-Dcryptomator.settingsPath=\"~/AppData/Roaming/Cryptomator/settings.json\"" --java-options "-Dcryptomator.ipcSocketPath=\"~/AppData/Roaming/Cryptomator/ipc.socket\"" --java-options "-Dcryptomator.keychainPath=\"~/AppData/Roaming/Cryptomator/keychain.json\"" @@ -130,9 +143,11 @@ jobs: - os: macos-latest profile: mac jpackageoptions: > - --app-version "${{ needs.metadata.outputs.versionNum }}" + --app-version "${{ needs.metadata.outputs.semVerNum }}" --java-options "-Dfile.encoding=\"utf-8\"" + --java-options "-Dapple.awt.enableTemplateImages=true" --java-options "-Dcryptomator.logDir=\"~/Library/Logs/Cryptomator\"" + --java-options "-Dcryptomator.pluginDir=\"~/Library/Application Support/Cryptomator/Plugins\"" --java-options "-Dcryptomator.settingsPath=\"~/Library/Application Support/Cryptomator/settings.json\"" --java-options "-Dcryptomator.ipcSocketPath=\"~/Library/Application Support/Cryptomator/ipc.socket\"" --java-options "-Dcryptomator.showTrayIcon=true" @@ -175,6 +190,7 @@ jobs: --copyright "(C) 2016 - 2021 Skymatic GmbH" --java-options "-Xss5m" --java-options "-Xmx256m" + --java-options "-Dcryptomator.appVersion=\"${{ needs.metadata.outputs.semVerStr }}\"" ${{ matrix.jpackageoptions }} - name: Create appdir.tar run: tar -cvf appdir.tar appdir @@ -185,6 +201,69 @@ jobs: path: appdir.tar if-no-files-found: error +# +# Linux PPA Source Package +# + ppa: + name: Upload source package to PPA + needs: [buildkit, metadata] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: install build tools + run: | + sudo apt-get update + sudo apt-get install debhelper devscripts dput + - name: Download linux-buildkit + uses: actions/download-artifact@v2 + with: + name: linux-buildkit + path: pkgdir + - name: create orig.tar.gz + run: tar -cJf cryptomator_${{ needs.metadata.outputs.ppaVerStr }}.orig.tar.xz -C pkgdir . + - name: patch and rename pkgdir + run: | + cp -r dist/linux/debian/ pkgdir + cp -r dist/linux/resources/ pkgdir + export RFC2822_TIMESTAMP=`date --rfc-2822` + envsubst '${VERSION_STR} ${VERSION_NUM} ${REVISION_NUM}' < dist/linux/debian/rules > pkgdir/debian/rules + envsubst '${VERSION_STR}' < dist/linux/debian/org.cryptomator.Cryptomator.desktop > pkgdir/debian/org.cryptomator.Cryptomator.desktop + envsubst '${PPA_VERSION} ${RFC2822_TIMESTAMP}' < dist/linux/debian/changelog > pkgdir/debian/changelog + find . -name "*.jar" >> pkgdir/debian/source/include-binaries + mv pkgdir cryptomator_${{ needs.metadata.outputs.ppaVerStr }} + env: + VERSION_STR: ${{ needs.metadata.outputs.semVerStr }} + VERSION_NUM: ${{ needs.metadata.outputs.semVerNum }} + REVISION_NUM: ${{ needs.metadata.outputs.revNum }} + PPA_VERSION: ${{ needs.metadata.outputs.ppaVerStr }}-0ppa1 + - name: import gpg key 615D449FE6E6A235 + run: | + echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import + echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --dry-run --sign dist/linux/debian/rules + env: + GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} + GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} + - name: debuild + run: debuild -S -sa -d + env: + DEBSIGN_PROGRAM: gpg --batch --pinentry-mode loopback + DEBSIGN_KEYID: 615D449FE6E6A235 + working-directory: cryptomator_${{ needs.metadata.outputs.ppaVerStr }} + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: linux-deb-source-package + path: | + cryptomator_*.dsc + cryptomator_*.orig.tar.xz + cryptomator_*.debian.tar.xz + cryptomator_*_source.changes + cryptomator_*_source.buildinfo + - name: dput to beta repo + run: dput ppa:sebastian-stenzel/cryptomator-beta cryptomator_${PPA_VERSION}_source.changes + env: + PPA_VERSION: ${{ needs.metadata.outputs.ppaVerStr }}-0ppa1 + # # Linux Cryptomator.AppImage # @@ -205,7 +284,7 @@ jobs: run: | mv appdir/Cryptomator Cryptomator.AppDir cp -r dist/linux/appimage/resources/AppDir/* Cryptomator.AppDir/ - envsubst '${REVISION_NO}' < dist/linux/appimage/resources/AppDir/bin/cryptomator.sh > Cryptomator.AppDir/bin/cryptomator.sh + envsubst '${REVISION_NO} ${SEMVER_STR}' < dist/linux/appimage/resources/AppDir/bin/cryptomator.sh > Cryptomator.AppDir/bin/cryptomator.sh ln -s usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/org.cryptomator.Cryptomator.svg ln -s usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/Cryptomator.svg ln -s usr/share/icons/hicolor/scalable/apps/org.cryptomator.Cryptomator.svg Cryptomator.AppDir/.DirIcon @@ -213,6 +292,7 @@ jobs: ln -s bin/cryptomator.sh Cryptomator.AppDir/AppRun env: REVISION_NO: ${{ needs.metadata.outputs.revNum }} + SEMVER_STR: ${{ needs.metadata.outputs.semVerStr }} - name: Extract libjffi.so # workaround for https://github.com/cryptomator/cryptomator-linux/issues/27 run: | JFFI_NATIVE_JAR=`ls lib/app/ | grep -e 'jffi-[1-9]\.[0-9]\{1,2\}.[0-9]\{1,2\}-native.jar'` @@ -233,7 +313,7 @@ jobs: GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} - name: Build AppImage run: > - ./squashfs-root/AppRun Cryptomator.AppDir cryptomator-${{ needs.metadata.outputs.versionStr }}-x86_64.AppImage + ./squashfs-root/AppRun Cryptomator.AppDir cryptomator-${{ needs.metadata.outputs.semVerStr }}-x86_64.AppImage -u 'gh-releases-zsync|cryptomator|cryptomator|latest|cryptomator-*-x86_64.AppImage.zsync' --sign --sign-key=615D449FE6E6A235 --sign-args="--batch --pinentry-mode loopback" - name: Upload AppImage @@ -263,10 +343,11 @@ jobs: - name: Patch Cryptomator.app run: | mv appdir/Cryptomator.app Cryptomator.app + mv dist/mac/resources/Cryptomator-Vault.icns Cryptomator.app/Contents/Resources/ sed -i '' "s|###BUNDLE_SHORT_VERSION_STRING###|${VERSION_NO}|g" Cryptomator.app/Contents/Info.plist sed -i '' "s|###BUNDLE_VERSION###|${REVISION_NO}|g" Cryptomator.app/Contents/Info.plist env: - VERSION_NO: ${{ needs.metadata.outputs.versionNum }} + VERSION_NO: ${{ needs.metadata.outputs.semVerNum }} REVISION_NO: ${{ needs.metadata.outputs.revNum }} - name: Install codesign certificate env: @@ -300,8 +381,8 @@ jobs: OUTPUT_PATH=${JAR_PATH%.*} echo "Codesigning libs in ${JAR_FILENAME}..." unzip -q ${JAR_PATH} -d ${OUTPUT_PATH} - find ${OUTPUT_PATH} -name '*.dylib' -exec codesign -s ${CODESIGN_IDENTITY} {} \; - find ${OUTPUT_PATH} -name '*.jnilib' -exec codesign -s ${CODESIGN_IDENTITY} {} \; + find ${OUTPUT_PATH} -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \; + find ${OUTPUT_PATH} -name '*.jnilib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \; rm ${JAR_PATH} pushd ${OUTPUT_PATH} > /dev/null zip -qr ../${JAR_FILENAME} * @@ -368,7 +449,7 @@ jobs: --icon ".VolumeIcon.icns" 512 758 Cryptomator-${VERSION_NO}.dmg dmg env: - VERSION_NO: ${{ needs.metadata.outputs.versionNum }} + VERSION_NO: ${{ needs.metadata.outputs.semVerNum }} - name: Install notarization credentials env: NOTARIZATION_KEYCHAIN_PROFILE: ${{ secrets.MACOS_NOTARIZATION_KEYCHAIN_PROFILE }} @@ -397,6 +478,8 @@ jobs: - name: Clean up notarization credentials if: ${{ always() }} run: security delete-keychain $RUNNER_TEMP/notarization.keychain-db + - name: Add possible alpha/beta tags to installer name + run: mv Cryptomator-*.dmg Cryptomator-${{ needs.metadata.outputs.semVerStr }}.dmg - name: Upload mac-dmg uses: actions/upload-artifact@v2 with: @@ -449,12 +532,14 @@ jobs: --name Cryptomator --vendor "Skymatic GmbH" --copyright "(C) 2016 - 2021 Skymatic GmbH" - --app-version "${{ needs.metadata.outputs.versionNum }}" + --app-version "${{ needs.metadata.outputs.semVerNum }}" --win-menu --win-dir-chooser + --win-shortcut-prompt + --win-update-url "https:\\cryptomator.org" + --win-menu-group Cryptomator --resource-dir dist/win/resources --license-file dist/win/resources/license.rtf - --file-associations dist/win/resources/FAencryptedData.properties --file-associations dist/win/resources/FAvaultFile.properties env: JP_WIXWIZARD_RESOURCES: ${{ github.workspace }}/dist/win/resources # requires abs path, used in resources/main.wxs @@ -467,6 +552,8 @@ jobs: description: Cryptomator Installer timestampUrl: 'http://timestamp.digicert.com' folder: installer + - name: Add possible alpha/beta tags to installer name + run: mv installer/Cryptomator-*.msi installer/Cryptomator-${{ needs.metadata.outputs.semVerStr }}-x64.msi - name: Upload win-msi uses: actions/upload-artifact@v2 with: @@ -480,12 +567,12 @@ jobs: release: name: Draft a release on Github runs-on: ubuntu-latest - needs: [metadata,linux-appimage,mac-dmg,win-msi] + needs: [metadata,linux-appimage,mac-dmg,win-msi,ppa] if: startsWith(github.ref, 'refs/tags/') && github.repository == 'cryptomator/cryptomator' steps: - uses: actions/checkout@v2 - name: Create tarball - run: git archive --prefix="cryptomator-${{ needs.metadata.outputs.versionStr }}/" -o "cryptomator-${{ needs.metadata.outputs.versionStr }}.tar.gz" ${{ github.ref }} + run: git archive --prefix="cryptomator-${{ needs.metadata.outputs.semVerStr }}/" -o "cryptomator-${{ needs.metadata.outputs.semVerStr }}.tar.gz" ${{ github.ref }} - name: Download linux appimage uses: actions/download-artifact@v2 with: @@ -507,6 +594,13 @@ jobs: env: GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} + - name: Compute SHA256 checksums of release artifacts + run: | + SHA256_SUMS=`find . -name "*.AppImage" -o -name "*.dmg" -o -name "*.msi" -o -name "*.tar.gz" | xargs sha256sum` + echo "SHA256_SUMS<> $GITHUB_ENV + echo "${SHA256_SUMS}" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + continue-on-error: true - name: Create release draft uses: softprops/action-gh-release@v1 with: @@ -527,3 +621,8 @@ jobs: ## Misc --- :scroll: A complete list of closed issues is available [here](LINK) + --- + :floppy_disk: SHA-256 checksums of release artifacts: + ``` + ${{ env.SHA256_SUMS }} + ``` diff --git a/.idea/icon.svg b/.idea/icon.svg new file mode 100644 index 000000000..53e7c879a --- /dev/null +++ b/.idea/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 68ef79a67..4731638fd 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations/Cryptomator_Linux.xml b/.idea/runConfigurations/Cryptomator_Linux.xml index 2d55618de..b8339789b 100644 --- a/.idea/runConfigurations/Cryptomator_Linux.xml +++ b/.idea/runConfigurations/Cryptomator_Linux.xml @@ -2,7 +2,7 @@