From c10e666dad2e221ca4947b3628ea6e948116d5a6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 31 Mar 2023 11:00:30 +0100 Subject: [PATCH] Ship linux tarball with static sqlcipher (#597) --- .github/workflows/build_and_deploy.yaml | 19 ++++++++++++-- .github/workflows/build_linux.yaml | 34 ++++++++++++++++++++++++- .github/workflows/build_macos.yaml | 2 +- .github/workflows/build_windows.yaml | 2 +- 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_deploy.yaml b/.github/workflows/build_and_deploy.yaml index 0adc19c..49e4ee0 100644 --- a/.github/workflows/build_and_deploy.yaml +++ b/.github/workflows/build_and_deploy.yaml @@ -90,22 +90,37 @@ jobs: base-url: https://packages.element.io/${{ inputs.mode == 'release' && 'desktop' || 'nightly' }} version: ${{ needs.prepare.outputs.macos-version }} + # We do not put this call into deploy-mode as we do not want it to add to the packages.element.io artifact + # We ship this build via reprepro only linux: if: github.event_name != 'workflow_dispatch' || inputs.linux needs: prepare - name: Linux + name: Linux (sqlcipher system) uses: ./.github/workflows/build_linux.yaml with: config: element.io/${{ inputs.mode || 'nightly' }} sqlcipher: system version: ${{ needs.prepare.outputs.linux-version }} - # This deploy job only handles Windows & macOS as those are stateless and static. + # We ship the static build via static tarball only + linux_static: + if: github.event_name != 'workflow_dispatch' || inputs.linux + needs: prepare + name: Linux (sqlcipher static) + uses: ./.github/workflows/build_linux.yaml + with: + deploy-mode: true + config: element.io/${{ inputs.mode || 'nightly' }} + sqlcipher: static + version: ${{ needs.prepare.outputs.linux-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. deploy: needs: - macos - linux + - linux_static - windows_32bit - windows_64bit runs-on: ubuntu-latest diff --git a/.github/workflows/build_linux.yaml b/.github/workflows/build_linux.yaml index f8eff43..676a250 100644 --- a/.github/workflows/build_linux.yaml +++ b/.github/workflows/build_linux.yaml @@ -16,6 +16,10 @@ on: type: string required: true description: "How to link sqlcipher, one of 'system' | 'static'" + deploy-mode: + type: boolean + required: false + description: "Whether to arrange artifacts in the arrangement needed for deployment, skipping unrelated ones" jobs: build: runs-on: ubuntu-latest @@ -84,9 +88,37 @@ jobs: --deb-custom-control=debcontrol yarn build --publish never -l --config electron-builder.json + - name: Stash deb package + if: inputs.deploy-mode + uses: actions/upload-artifact@v3 + with: + name: linux-sqlcipher-${{ inputs.sqlcipher }}-deb + path: dist/*.deb + retention-days: 1 + + - name: Prepare artifacts for deployment + if: inputs.deploy-mode + run: | + mv dist _dist + mkdir -p "dist/install/linux/glibc-x86-64/" + mv _dist/*.tar.gz "dist/install/linux/glibc-x86-64" + + # We don't wish to store the tarball for every nightly ever, so we only keep the latest + - name: "[Nightly] Strip version from tarball" + if: inputs.deploy-mode && inputs.version != '' + run: | + mv dist/install/linux/glibc-x86-64/*.tar.gz "dist/install/linux/glibc-x86-64/element-desktop-nightly.tar.gz" + + - name: "[Release] Prepare release latest symlink" + if: inputs.deploy-mode && inputs.version == '' + shell: bash + run: | + ln -s "$(find . -type f -iname "*.tar.gz" | xargs -0 -n1 -- basename)" "element-desktop.tar.gz" + working-directory: "dist/install/linux/glibc-x86-64" + - name: Upload Artifacts uses: actions/upload-artifact@v3 with: - name: linux-sqlcipher-${{ inputs.sqlcipher }} + name: ${{ inputs.deploy-mode && 'packages.element.io' || format('linux-sqlcipher-{0}', inputs.sqlcipher) }} path: dist retention-days: 1 diff --git a/.github/workflows/build_macos.yaml b/.github/workflows/build_macos.yaml index e032f12..26d3f87 100644 --- a/.github/workflows/build_macos.yaml +++ b/.github/workflows/build_macos.yaml @@ -24,7 +24,7 @@ on: required: false description: "Whether to sign & notarise the build, requires 'packages.element.io' environment" deploy-mode: - type: string + type: boolean required: false description: "Whether to arrange artifacts in the arrangement needed for deployment, skipping unrelated ones" base-url: diff --git a/.github/workflows/build_windows.yaml b/.github/workflows/build_windows.yaml index 6acee52..ff4f07a 100644 --- a/.github/workflows/build_windows.yaml +++ b/.github/workflows/build_windows.yaml @@ -24,7 +24,7 @@ on: required: false description: "Whether to sign & notarise the build, requires 'packages.element.io' environment" deploy-mode: - type: string + type: boolean required: false description: "Whether to arrange artifacts in the arrangement needed for deployment, skipping unrelated ones" jobs: