From d67822dae37dd1c7c9f00cd8f8fa97b924776817 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 3 Aug 2023 16:32:53 +0100 Subject: [PATCH] Simplify desktop packaging (#896) --- .github/workflows/build_and_deploy.yaml | 45 ++++++++--------------- .github/workflows/build_prepare.yaml | 47 +++++++++---------------- 2 files changed, 31 insertions(+), 61 deletions(-) diff --git a/.github/workflows/build_and_deploy.yaml b/.github/workflows/build_and_deploy.yaml index 3cd3200..6cfebc6 100644 --- a/.github/workflows/build_and_deploy.yaml +++ b/.github/workflows/build_and_deploy.yaml @@ -19,13 +19,8 @@ on: required: true type: boolean default: true - windows_32bit: - description: Build Windows 32-bit - required: true - type: boolean - default: true - windows_64bit: - description: Build Windows 64-bit + windows: + description: Build Windows required: true type: boolean default: true @@ -54,29 +49,20 @@ jobs: CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} CF_R2_TOKEN: ${{ secrets.CF_R2_TOKEN }} - windows_32bit: - if: github.event_name != 'workflow_dispatch' || inputs.windows_32bit + windows: + if: github.event_name != 'workflow_dispatch' || inputs.windows needs: prepare - name: Windows 32-bit + name: Windows ${{ matrix.arch }} + strategy: + matrix: + arch: [x86, x64] uses: ./.github/workflows/build_windows.yaml secrets: inherit with: sign: true deploy-mode: true - arch: x86 - version: ${{ needs.prepare.outputs.win32-x86-version }} - - windows_64bit: - if: github.event_name != 'workflow_dispatch' || inputs.windows_64bit - needs: prepare - name: Windows 64-bit - uses: ./.github/workflows/build_windows.yaml - secrets: inherit - with: - sign: true - deploy-mode: true - arch: x64 - version: ${{ needs.prepare.outputs.win32-x64-version }} + arch: ${{ matrix.arch }} + version: ${{ needs.prepare.outputs.nightly-version }} macos: if: github.event_name != 'workflow_dispatch' || inputs.macos @@ -88,7 +74,7 @@ jobs: sign: true deploy-mode: true base-url: https://packages.element.io/${{ inputs.mode == 'release' && 'desktop' || 'nightly' }} - version: ${{ needs.prepare.outputs.macos-version }} + version: ${{ needs.prepare.outputs.nightly-version }} # We do not put these calls into deploy-mode as we do not want it to add to the packages.element.io artifact # We ship this build via reprepro only @@ -104,7 +90,7 @@ jobs: arch: ${{ matrix.arch }} config: element.io/${{ inputs.mode || 'nightly' }} sqlcipher: system - version: ${{ needs.prepare.outputs.linux-version }} + version: ${{ needs.prepare.outputs.nightly-version }} # We ship the static build via static tarball only linux_static: @@ -117,7 +103,7 @@ jobs: deploy-mode: true config: element.io/${{ inputs.mode || 'nightly' }} sqlcipher: static - version: ${{ needs.prepare.outputs.linux-version }} + version: ${{ needs.prepare.outputs.nightly-version }} # This deploy job only handles Windows, macOS & linux_static as those are stateless and static. # Linux will be deployed via reprepro after it, but we list it as a dependency to abort if it fails. @@ -126,14 +112,13 @@ jobs: - macos - linux - linux_static - - windows_32bit - - windows_64bit + - windows runs-on: ubuntu-latest name: Deploy if: | github.event_name != 'workflow_dispatch' || ( always() && !failure() && !cancelled() && inputs.deploy && - (inputs.macos || inputs.windows_32bit || inputs.windows_64bit) + (inputs.macos || inputs.windows || inputs.linux) ) environment: packages.element.io steps: diff --git a/.github/workflows/build_prepare.yaml b/.github/workflows/build_prepare.yaml index 5638951..3854ea6 100644 --- a/.github/workflows/build_prepare.yaml +++ b/.github/workflows/build_prepare.yaml @@ -23,28 +23,16 @@ on: CF_R2_TOKEN: required: false outputs: - macos-version: - description: "The version string the next macOS Nightly should use, only output for nightly" - value: ${{ jobs.prepare.outputs.macos-version }} - linux-version: - description: "The version string the next Linux Nightly should use, only output for nightly" - value: ${{ jobs.prepare.outputs.linux-version }} - win32-x64-version: - description: "The version string the next Windows x64 Nightly should use, only output for nightly" - value: ${{ jobs.prepare.outputs.win32-x64-version }} - win32-x86-version: - description: "The version string the next Windows x86 Nightly should use, only output for nightly" - value: ${{ jobs.prepare.outputs.win32-x86-version }} + nightly-version: + description: "The version string the next Nightly should use, only output for nightly" + value: ${{ jobs.prepare.outputs.nightly-version }} jobs: prepare: name: Prepare environment: ${{ inputs.nightly && 'packages.element.io' || '' }} runs-on: ubuntu-latest outputs: - macos-version: ${{ steps.versions.outputs.macos }} - linux-version: ${{ steps.versions.outputs.linux }} - win32-x64-version: ${{ steps.versions.outputs.win_x64 }} - win32-x86-version: ${{ steps.versions.outputs.win_x86 }} + nightly-version: ${{ steps.versions.outputs.nightly }} steps: - uses: actions/checkout@v3 @@ -66,20 +54,21 @@ jobs: find hak -type f -print0 | xargs -0 sha1sum >> hakHash find scripts/hak -type f -print0 | xargs -0 sha1sum >> hakHash - - name: "[Nightly] Calculate versions" + - name: "[Nightly] Calculate version" id: versions if: inputs.nightly run: | - MACOS=$(aws s3 cp s3://$R2_BUCKET/nightly/update/macos/releases.json - --endpoint-url $R2_URL --region auto | jq -r .currentRelease) - echo "macos=$(scripts/generate-nightly-version.ts --latest $MACOS)" >> $GITHUB_OUTPUT + # Find all latest Nightly versions + aws s3 cp s3://$R2_BUCKET/nightly/update/macos/releases.json - --endpoint-url $R2_URL --region auto | jq -r .currentRelease >> VERSIONS + aws s3 cp s3://$R2_BUCKET/debian/dists/default/main/binary-amd64/Packages - --endpoint-url $R2_URL --region auto | grep "Package: element-nightly" -A 50 | grep Version -m1 | sed -n 's/Version: //p' >> VERSIONS + aws s3 cp s3://$R2_BUCKET/debian/dists/default/main/binary-arm64/Packages - --endpoint-url $R2_URL --region auto | grep "Package: element-nightly" -A 50 | grep Version -m1 | sed -n 's/Version: //p' >> VERSIONS + aws s3 cp s3://$R2_BUCKET/nightly/update/win32/x64/RELEASES - --endpoint-url $R2_URL --region auto | awk '{print $2}' | cut -d "-" -f 5 | cut -c 8- >> VERSIONS + aws s3 cp s3://$R2_BUCKET/nightly/update/win32/ia32/RELEASES - --endpoint-url $R2_URL --region auto | awk '{print $2}' | cut -d "-" -f 5 | cut -c 8- >> VERSIONS - LINUX=$(aws s3 cp s3://$R2_BUCKET/debian/dists/default/main/binary-amd64/Packages - --endpoint-url $R2_URL --region auto | grep "Package: element-nightly" -A 50 | grep Version -m1 | sed -n 's/Version: //p') - echo "linux=$(scripts/generate-nightly-version.ts --latest $LINUX)" >> $GITHUB_OUTPUT - - WINx64=$(aws s3 cp s3://$R2_BUCKET/nightly/update/win32/x64/RELEASES - --endpoint-url $R2_URL --region auto | awk '{print $2}' | cut -d "-" -f 5 | cut -c 8-) - echo "win_x64=$(scripts/generate-nightly-version.ts --latest $WINx64)" >> $GITHUB_OUTPUT - WINx86=$(aws s3 cp s3://$R2_BUCKET/nightly/update/win32/ia32/RELEASES - --endpoint-url $R2_URL --region auto | awk '{print $2}' | cut -d "-" -f 5 | cut -c 8-) - echo "win_x86=$(scripts/generate-nightly-version.ts --latest $WINx86)" >> $GITHUB_OUTPUT + # Pick the greatest one + VERSION=$(cat VERSIONS | sort -uf | tail -n1) + # Increment it + echo "nightly=$(scripts/generate-nightly-version.ts --latest $VERSION)" >> $GITHUB_OUTPUT env: AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_TOKEN }} @@ -123,14 +112,10 @@ jobs: REACT_VERSION=${WEBAPP_VERSION:19:12} JS_VERSION=${WEBAPP_VERSION:35:12} - echo "### Nightly build" >> $GITHUB_STEP_SUMMARY + echo "### Nightly build ${{ steps.versions.outputs.nightly }}" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "| Component | Version |" >> $GITHUB_STEP_SUMMARY echo "| ----------- | ------- |" >> $GITHUB_STEP_SUMMARY - echo "| macOS | ${{ steps.versions.outputs.macos }} |" >> $GITHUB_STEP_SUMMARY - echo "| Linux | ${{ steps.versions.outputs.linux }} |" >> $GITHUB_STEP_SUMMARY - echo "| Windows x64 | ${{ steps.versions.outputs.win_x64 }} |" >> $GITHUB_STEP_SUMMARY - echo "| Windows x86 | ${{ steps.versions.outputs.win_x86 }} |" >> $GITHUB_STEP_SUMMARY echo "| Bundle Hash | $BUNDLE_HASH |" >> $GITHUB_STEP_SUMMARY echo "| Element Web | [$WEB_VERSION](https://github.com/vector-im/element-web/commit/$WEB_VERSION) |" >> $GITHUB_STEP_SUMMARY echo "| React SDK | [$REACT_VERSION](https://github.com/matrix-org/matrix-react-sdk/commit/$REACT_VERSION) |" >> $GITHUB_STEP_SUMMARY