diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index e18f048a6..0bd519d39 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -17,11 +17,11 @@ jobs: name: Build AppImage runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup Java - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3707cd46f..94c9ab037 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,20 +12,54 @@ defaults: run: shell: bash -jobs: - test: - name: Compile and Test +jobs: + release-check-precondition: + name: Validate pushed commit to release/hotfix branch or pushed tag runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" + if: "(startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/hotfix/') || startsWith(github.ref, 'refs/heads/release/')) + && !(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 + - id: validate-pom-version + name: Validate POM version + run: | + if [[ $GITHUB_REF =~ refs/heads/(hotfix|release)/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then + SEM_VER_STR=${GITHUB_REF##*/} + elif [[ $GITHUB_REF =~ refs/tags/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then + SEM_VER_STR=${GITHUB_REF##*/} + else + echo "Failed to parse version" + exit 1 + fi + + if [[ ${SEM_VER_STR} == `mvn help:evaluate -Dexpression=project.version -q -DforceStdout` ]]; then + echo "::set-output name=semVerStr::${SEM_VER_STR}" + else + echo "Version not set in POM" + exit 1 + fi + - name: Validate release in org.cryptomator.Cryptomator.metainfo.xml file + run: | + if ! grep -q "" dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml; then + echo "Release not set in dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml" + exit 1 + fi + test: + name: Compile and Test + needs: release-check-precondition + runs-on: ubuntu-latest + if: "always() + && (needs.release-check-precondition.result=='success' || needs.release-check-precondition.result=='skipped') + && !(contains(github.event.head_commit.message, '[ci skip]') || contains(github.event.head_commit.message, '[skip ci]'))" + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} cache: 'maven' - name: Cache SonarCloud packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index fb0a8f9e3..ec3c45f8e 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -22,7 +22,7 @@ jobs: name: Build Debian Package runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Install build tools @@ -30,7 +30,7 @@ jobs: sudo apt-get update sudo apt-get install debhelper devscripts dput - name: Setup Java - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} diff --git a/.github/workflows/mac-dmg.yml b/.github/workflows/mac-dmg.yml index 21a790fa0..b51430ee0 100644 --- a/.github/workflows/mac-dmg.yml +++ b/.github/workflows/mac-dmg.yml @@ -17,17 +17,19 @@ jobs: name: Build Cryptomator.app for ${{ matrix.output-suffix }} runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: include: - os: macos-11 architecture: x64 output-suffix: x64 + xcode-path: '/Applications/Xcode_13.2.1.app' - os: [self-hosted, macOS, ARM64] architecture: aarch64 output-suffix: arm64 + xcode-path: '/Applications/Xcode_13.2.1.app' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup Java @@ -37,7 +39,7 @@ jobs: java-version: ${{ env.JAVA_VERSION }} architecture: ${{ matrix.architecture }} cache: 'maven' - - id: versions + - id: versions name: Apply version information run: | if [[ $GITHUB_REF =~ refs/tags/[0-9]+\.[0-9]+\.[0-9]+.* ]]; then @@ -208,6 +210,7 @@ jobs: apple-id: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }} password: ${{ secrets.MACOS_NOTARIZATION_PW }} team-id: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }} + xcode-path: ${{ matrix.xcode-path }} - name: Add possible alpha/beta tags to installer name run: mv Cryptomator-*.dmg Cryptomator-${{ steps.versions.outputs.semVerStr }}-${{ matrix.output-suffix }}.dmg - name: Create detached GPG signature with key 615D449FE6E6A235 diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 66fab46a5..48f7bd185 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -16,8 +16,8 @@ jobs: 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 + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} diff --git a/.github/workflows/win-exe.yml b/.github/workflows/win-exe.yml index 55ee4b2b0..46e1dbed1 100644 --- a/.github/workflows/win-exe.yml +++ b/.github/workflows/win-exe.yml @@ -8,11 +8,6 @@ on: version: description: 'Version' required: false - winget-release: - description: 'Release artifacts to winget' - required: true - type: boolean - default: false env: JAVA_VERSION: 19 @@ -28,11 +23,11 @@ jobs: name: Build .msi Installer runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup Java - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: ${{ env.JAVA_DIST }} java-version: ${{ env.JAVA_VERSION }} @@ -196,34 +191,28 @@ jobs: semVerStr: ${{ steps.versions.outputs.semVerStr }} revNum: ${{ steps.versions.outputs.revNum }} - publish-winget: - name: Publish on winget repo - runs-on: windows-latest + call-winget-flow: needs: [build-msi] - if: github.event.action == 'published' || inputs.winget-release - steps: - - name: Submit package to Windows Package Manager Community Repository - run: | - iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe - $github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json - $installerUrl = $github.release.assets | Where-Object -Property name -match '^Cryptomator-.*\.msi' | Select -ExpandProperty browser_download_url -First 1 - .\wingetcreate.exe update Cryptomator.Cryptomator -s -v $github.release.tag_name -u $installerUrl -t ${{ secrets.CRYPTOBOT_WINGET_TOKEN }} - shell: pwsh + if: github.event.action == 'published' + uses: ./.github/workflows/winget.yml + with: + releaseTag: ${{ github.event.release.tag_name }} + build-exe: name: Build .exe installer runs-on: windows-latest needs: [build-msi] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download .msi - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: msi path: dist/win/bundle/resources - name: Strip version info from msi file name run: mv dist/win/bundle/resources/Cryptomator*.msi dist/win/bundle/resources/Cryptomator.msi - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: distribution: ${{ env.JAVA_DIST }} java-version: ${{ env.JAVA_VERSION }} diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml new file mode 100644 index 000000000..7115a1785 --- /dev/null +++ b/.github/workflows/winget.yml @@ -0,0 +1,49 @@ +name: Release to Winget + +on: + workflow_call: + inputs: + releaseTag: + required: true + type: string + workflow_dispatch: + inputs: + releaseTag: + description: 'Release tag name' + required: true + type: string + +jobs: + publish-winget: + name: Publish on winget repo + runs-on: windows-latest + steps: + - name: Get download url for msi artifacts + id: get-release-assets + uses: actions/github-script@v6 + with: + script: | + const query =`query($tag:String!) { + repository(owner:"cryptomator", name:"cryptomator"){ + release(tagName: $tag) { + releaseAssets(first:20) { + nodes { + name + downloadUrl + } + } + } + } + }`; + const variables = { + tag: "${{ inputs.releaseTag }}" + } + return await github.graphql(query, variables) + - name: Submit package to Windows Package Manager Community Repository + id: submit-winget + run: | + iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe + $releaseAssets = (ConvertFrom-Json '${{ steps.get-release-assets.outputs.result }}').repository.release.releaseAssets.nodes + $installerUrl = $releaseAssets | Where-Object -Property name -match '^Cryptomator-.*\.msi$' | Select -ExpandProperty downloadUrl -First 1 + .\wingetcreate.exe update Cryptomator.Cryptomator -s -v "${{ inputs.releaseTag }}" -u "$installerUrl" -t ${{ secrets.CRYPTOBOT_WINGET_TOKEN }} + shell: pwsh diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 18be437d6..18e7c76e0 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -14,10 +14,10 @@