diff --git a/.github/workflows/linux-flatpak.yml b/.github/workflows/linux-flatpak.yml index d8a02b61a..1f28a9c43 100644 --- a/.github/workflows/linux-flatpak.yml +++ b/.github/workflows/linux-flatpak.yml @@ -8,6 +8,11 @@ on: tag: description: 'Release tag' required: false + create-pr: + description: 'Create Flathub PR' + required: false + type: boolean + default: false push: branches-ignore: - 'dependabot/**' @@ -65,7 +70,7 @@ jobs: if-no-files-found: error path: | org.cryptomator.Cryptomator.${{matrix.variant.arch}}.yaml - - uses: flatpak/flatpak-github-actions/flatpak-builder@401fe28a8384095fc1531b9d320b292f0ee45adb # SNAPSHOT + - uses: flatpak/flatpak-github-actions/flatpak-builder@401fe28a8384095fc1531b9d320b292f0ee45adb # SNAPSHOT due to using keep-build-dirs with: bundle: cryptomator.flatpak manifest-path: org.cryptomator.Cryptomator.yaml @@ -110,81 +115,90 @@ jobs: only-arches: [${{ matrix.variant.arch }}] EOF done < maven-dependency-files-javafx.txt - ) > maven-dependencies-javafx-${{ matrix.variant.arch }}.yaml + ) > javafx-maven-dependencies-${{ matrix.variant.arch }}.yaml - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: maven-sources-${{ matrix.variant.arch }} if-no-files-found: error path: | maven-dependencies.yaml - maven-dependencies-javafx-${{ matrix.variant.arch }}.yaml + javafx-maven-dependencies-${{ matrix.variant.arch }}.yaml - tarball: - name: Determines tarball url and compute checksum - runs-on: ubuntu-latest - needs: [get-version] - if: github.event_name == 'workflow_dispatch' || needs.get-version.outputs.versionType == 'stable' - outputs: - url: ${{ steps.url.outputs.url}} - sha512: ${{ steps.sha512.outputs.sha512}} - steps: - - name: Determine tarball url - id: url - run: | - URL="https://github.com/cryptomator/cryptomator/archive/refs/tags/${TAG}.tar.gz" - echo "url=${URL}" >> "$GITHUB_OUTPUT" - env: - TAG: ${{ inputs.tag || github.event.release.tag_name}} - - name: Download source tarball and compute checksum - id: sha512 - run: | - curl --silent --fail-with-body --proto "=https" -L -H "Accept: application/vnd.github+json" ${{ steps.url.outputs.url }} --output cryptomator.tar.gz - TARBALL_SHA512=$(sha512sum cryptomator.tar.gz | cut -d ' ' -f1) - echo "sha512=${TARBALL_SHA512}" >> "$GITHUB_OUTPUT" - flathub: + create-pr: name: Create PR for flathub runs-on: ubuntu-latest - needs: [tarball, get-version] + needs: [get-version, build-flatpak] + if: github.event_name == 'workflow_dispatch' && inputs.create-pr || github.event_name == 'release' && needs.get-version.outputs.versionType == 'stable' env: - FLATHUB_PR_URL: tbd + TARBALL_URL: 'https://github.com/cryptomator/cryptomator/archive/refs/tags/${{ needs.get-version.outputs.semVerStr || github.event.release.tag_name }}.tar.gz' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - repository: 'flathub/org.cryptomator.Cryptomator' + repository: flathub/org.cryptomator.Cryptomator + submodules: true #TODO: Update submodule! token: ${{ secrets.CRYPTOBOT_PR_TOKEN }} - name: Checkout release branch run: | git checkout -b release/${{ needs.get-version.outputs.semVerStr }} - - name: Update build file + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + path: cryptomator + - name: Download source tarball and compute checksum + id: sha512 run: | - sed -i -e 's/VERSION: [0-9]\+\.[0-9]\+\.[0-9]\+.*/VERSION: ${{ needs.get-version.outputs.semVerStr }}/g' org.cryptomator.Cryptomator.yaml - sed -i -e 's/sha512: [0-9A-Za-z_\+-]\{128\} #CRYPTOMATOR/sha512: ${{ needs.tarball.outputs.sha512 }} #CRYPTOMATOR/g' org.cryptomator.Cryptomator.yaml - sed -i -e 's;url: https://github.com/cryptomator/cryptomator/archive/refs/tags/[^[:blank:]]\+;url: ${{ needs.tarball.outputs.url }};g' org.cryptomator.Cryptomator.yaml + curl --silent --fail-with-body --proto "=https" -L -H "Accept: application/vnd.github+json" ${TARBALL_URL} --output cryptomator.tar.gz + TARBALL_SHA512=$(sha512sum cryptomator.tar.gz | cut -d ' ' -f1) + echo "value=${TARBALL_SHA512}" >> "$GITHUB_OUTPUT" + - name: Download updated maven aarch64 dependencies + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 + with: + name: maven-sources-aarch64 + path: mvn-src-aarch64 + - name: Download updated maven x86_64 dependencies + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 + with: + name: maven-sources-x86_64 + path: mvn-src-x64 + - name: Update build files + run: | + cp -r -f cryptomator/dist/linux/flatpak/* . + cp -r -f mvn-src-x64/* . + cp -r -f mvn-src-aarch64/* . + envsubst '$FLATPAK_VERSION $FLATPAK_REVISION $CRYPTOMATOR_SOURCE' < org.cryptomator.Cryptomator.TEMPLATE.yaml > org.cryptomator.Cryptomator.yaml + yq -i 'del(.modules[] | select(.name == "cryptomator") | .build-options.build-args)' org.cryptomator.Cryptomator.yaml + env: + FLATPAK_VERSION: ${{ needs.get-version.outputs.semVerNum }} + FLATPAK_REVISION: 1 + CRYPTOMATOR_SOURCE: |- + type: archive + sha512: ${{steps.sha512.outputs.value}} + url: ${{ env.TARBALL_URL }} - name: Commit and push run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" + git config user.name "cryptobot" + git config user.email "cryptobot@users.noreply.github.com" git config push.autoSetupRemote true - git stage . + git stage org.cryptomator.Cryptomator.yaml maven-dependencies.yaml javafx-maven-dependencies-aarch64.yaml javafx-maven-dependencies-x86_64.yaml git commit -m "Prepare release ${{needs.get-version.outputs.semVerStr}}" git push - name: Create pull request + id: create-pr run: | - printf "> [!IMPORTANT]\n> Todos:\n> - [ ] Update maven dependencies\n> - [ ] Check for JDK update\n> - [ ] Check for JFX update" > pr_body.md + printf "Created by $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > pr_body.md PR_URL=$(gh pr create --title "Release ${{ needs.get-version.outputs.semVerStr }}" --body-file pr_body.md) - echo "FLATHUB_PR_URL=$PR_URL" >> "$GITHUB_ENV" + echo "FLATHUB_PR_URL=$PR_URL" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ secrets.CRYPTOBOT_PR_TOKEN }} - name: Slack Notification uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2.3.3 if: github.event_name == 'release' env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CRYPTOMATOR_DESKTOP }} SLACK_USERNAME: 'Cryptobot' SLACK_ICON: false SLACK_ICON_EMOJI: ':bot:' SLACK_CHANNEL: 'cryptomator-desktop' SLACK_TITLE: "Flathub release PR created for ${{ github.event.repository.name }} ${{ github.event.release.tag_name }} created." - SLACK_MESSAGE: "See <${{ env.FLATHUB_PR_URL }}|PR> on how to proceed.>." + SLACK_MESSAGE: "See <${{ steps.create-pr.outputs.FLATHUB_PR_URL }}|PR> on how to proceed.>." SLACK_FOOTER: false - MSG_MINIMAL: true \ No newline at end of file + MSG_MINIMAL: true diff --git a/dist/linux/flatpak/javafx-maven-dependencies-aarch64.yaml b/dist/linux/flatpak/javafx-maven-dependencies-aarch64.yaml new file mode 100644 index 000000000..3ce2d05db --- /dev/null +++ b/dist/linux/flatpak/javafx-maven-dependencies-aarch64.yaml @@ -0,0 +1 @@ +# placeholder file \ No newline at end of file diff --git a/dist/linux/flatpak/javafx-maven-dependencies-x86_64.yaml b/dist/linux/flatpak/javafx-maven-dependencies-x86_64.yaml new file mode 100644 index 000000000..3ce2d05db --- /dev/null +++ b/dist/linux/flatpak/javafx-maven-dependencies-x86_64.yaml @@ -0,0 +1 @@ +# placeholder file \ No newline at end of file diff --git a/dist/linux/flatpak/maven-dependencies.yaml b/dist/linux/flatpak/maven-dependencies.yaml new file mode 100644 index 000000000..3ce2d05db --- /dev/null +++ b/dist/linux/flatpak/maven-dependencies.yaml @@ -0,0 +1 @@ +# placeholder file \ No newline at end of file diff --git a/dist/linux/flatpak/org.cryptomator.Cryptomator.TEMPLATE.yaml b/dist/linux/flatpak/org.cryptomator.Cryptomator.TEMPLATE.yaml index 0adc4e8ea..3cf0e91f7 100644 --- a/dist/linux/flatpak/org.cryptomator.Cryptomator.TEMPLATE.yaml +++ b/dist/linux/flatpak/org.cryptomator.Cryptomator.TEMPLATE.yaml @@ -146,6 +146,9 @@ modules: - install -D -m0644 -t /app/share/metainfo/ dist/linux/common/org.cryptomator.Cryptomator.metainfo.xml sources: - $CRYPTOMATOR_SOURCE + - maven-dependencies.yaml + - javafx-maven-dependencies-aarch64.yaml + - javafx-maven-dependencies-x86_64.yaml - type: file dest-filename: jdk.tar.gz only-arches: