Simplify desktop packaging (#896)

This commit is contained in:
Michael Telatynski 2023-08-03 16:32:53 +01:00 committed by GitHub
parent e2f7393ad5
commit d67822dae3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 61 deletions

View File

@ -19,13 +19,8 @@ on:
required: true required: true
type: boolean type: boolean
default: true default: true
windows_32bit: windows:
description: Build Windows 32-bit description: Build Windows
required: true
type: boolean
default: true
windows_64bit:
description: Build Windows 64-bit
required: true required: true
type: boolean type: boolean
default: true default: true
@ -54,29 +49,20 @@ jobs:
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
CF_R2_TOKEN: ${{ secrets.CF_R2_TOKEN }} CF_R2_TOKEN: ${{ secrets.CF_R2_TOKEN }}
windows_32bit: windows:
if: github.event_name != 'workflow_dispatch' || inputs.windows_32bit if: github.event_name != 'workflow_dispatch' || inputs.windows
needs: prepare needs: prepare
name: Windows 32-bit name: Windows ${{ matrix.arch }}
strategy:
matrix:
arch: [x86, x64]
uses: ./.github/workflows/build_windows.yaml uses: ./.github/workflows/build_windows.yaml
secrets: inherit secrets: inherit
with: with:
sign: true sign: true
deploy-mode: true deploy-mode: true
arch: x86 arch: ${{ matrix.arch }}
version: ${{ needs.prepare.outputs.win32-x86-version }} version: ${{ needs.prepare.outputs.nightly-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 }}
macos: macos:
if: github.event_name != 'workflow_dispatch' || inputs.macos if: github.event_name != 'workflow_dispatch' || inputs.macos
@ -88,7 +74,7 @@ jobs:
sign: true sign: true
deploy-mode: true deploy-mode: true
base-url: https://packages.element.io/${{ inputs.mode == 'release' && 'desktop' || 'nightly' }} 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 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 # We ship this build via reprepro only
@ -104,7 +90,7 @@ jobs:
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
config: element.io/${{ inputs.mode || 'nightly' }} config: element.io/${{ inputs.mode || 'nightly' }}
sqlcipher: system sqlcipher: system
version: ${{ needs.prepare.outputs.linux-version }} version: ${{ needs.prepare.outputs.nightly-version }}
# We ship the static build via static tarball only # We ship the static build via static tarball only
linux_static: linux_static:
@ -117,7 +103,7 @@ jobs:
deploy-mode: true deploy-mode: true
config: element.io/${{ inputs.mode || 'nightly' }} config: element.io/${{ inputs.mode || 'nightly' }}
sqlcipher: static 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. # 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. # 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 - macos
- linux - linux
- linux_static - linux_static
- windows_32bit - windows
- windows_64bit
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Deploy name: Deploy
if: | if: |
github.event_name != 'workflow_dispatch' || ( github.event_name != 'workflow_dispatch' || (
always() && !failure() && !cancelled() && inputs.deploy && always() && !failure() && !cancelled() && inputs.deploy &&
(inputs.macos || inputs.windows_32bit || inputs.windows_64bit) (inputs.macos || inputs.windows || inputs.linux)
) )
environment: packages.element.io environment: packages.element.io
steps: steps:

View File

@ -23,28 +23,16 @@ on:
CF_R2_TOKEN: CF_R2_TOKEN:
required: false required: false
outputs: outputs:
macos-version: nightly-version:
description: "The version string the next macOS Nightly should use, only output for nightly" description: "The version string the next Nightly should use, only output for nightly"
value: ${{ jobs.prepare.outputs.macos-version }} value: ${{ jobs.prepare.outputs.nightly-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 }}
jobs: jobs:
prepare: prepare:
name: Prepare name: Prepare
environment: ${{ inputs.nightly && 'packages.element.io' || '' }} environment: ${{ inputs.nightly && 'packages.element.io' || '' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
macos-version: ${{ steps.versions.outputs.macos }} nightly-version: ${{ steps.versions.outputs.nightly }}
linux-version: ${{ steps.versions.outputs.linux }}
win32-x64-version: ${{ steps.versions.outputs.win_x64 }}
win32-x86-version: ${{ steps.versions.outputs.win_x86 }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -66,20 +54,21 @@ jobs:
find hak -type f -print0 | xargs -0 sha1sum >> hakHash find hak -type f -print0 | xargs -0 sha1sum >> hakHash
find scripts/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 id: versions
if: inputs.nightly if: inputs.nightly
run: | run: |
MACOS=$(aws s3 cp s3://$R2_BUCKET/nightly/update/macos/releases.json - --endpoint-url $R2_URL --region auto | jq -r .currentRelease) # Find all latest Nightly versions
echo "macos=$(scripts/generate-nightly-version.ts --latest $MACOS)" >> $GITHUB_OUTPUT 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') # Pick the greatest one
echo "linux=$(scripts/generate-nightly-version.ts --latest $LINUX)" >> $GITHUB_OUTPUT VERSION=$(cat VERSIONS | sort -uf | tail -n1)
# Increment it
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 "nightly=$(scripts/generate-nightly-version.ts --latest $VERSION)" >> $GITHUB_OUTPUT
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
env: env:
AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_TOKEN }} AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_TOKEN }}
@ -123,14 +112,10 @@ jobs:
REACT_VERSION=${WEBAPP_VERSION:19:12} REACT_VERSION=${WEBAPP_VERSION:19:12}
JS_VERSION=${WEBAPP_VERSION:35: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 "" >> $GITHUB_STEP_SUMMARY
echo "| Component | Version |" >> $GITHUB_STEP_SUMMARY echo "| Component | Version |" >> $GITHUB_STEP_SUMMARY
echo "| ----------- | ------- |" >> $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 "| 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 "| 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 echo "| React SDK | [$REACT_VERSION](https://github.com/matrix-org/matrix-react-sdk/commit/$REACT_VERSION) |" >> $GITHUB_STEP_SUMMARY