2023-01-31 14:22:30 +01:00
|
|
|
name: Build and Deploy
|
|
|
|
on:
|
2023-02-22 14:51:19 +01:00
|
|
|
# Nightly build
|
2025-01-17 15:04:32 +01:00
|
|
|
# schedule:
|
|
|
|
# - cron: "0 9 * * *"
|
2023-08-04 10:12:53 +02:00
|
|
|
# Release build
|
|
|
|
release:
|
|
|
|
types: [published]
|
2023-02-22 14:51:19 +01:00
|
|
|
# Manual nightly & release
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
mode:
|
2023-02-27 10:52:47 +01:00
|
|
|
description: What type of build to trigger. Release builds MUST be ran from the `master` branch.
|
2023-02-22 14:51:19 +01:00
|
|
|
required: true
|
|
|
|
default: nightly
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- nightly
|
|
|
|
- release
|
|
|
|
macos:
|
2023-02-27 10:52:47 +01:00
|
|
|
description: Build macOS
|
2023-02-22 14:51:19 +01:00
|
|
|
required: true
|
|
|
|
type: boolean
|
|
|
|
default: true
|
2023-08-03 17:32:53 +02:00
|
|
|
windows:
|
|
|
|
description: Build Windows
|
2023-02-22 14:51:19 +01:00
|
|
|
required: true
|
|
|
|
type: boolean
|
|
|
|
default: true
|
|
|
|
linux:
|
2023-02-27 10:52:47 +01:00
|
|
|
description: Build Linux
|
2023-02-22 14:51:19 +01:00
|
|
|
required: true
|
|
|
|
type: boolean
|
|
|
|
default: true
|
|
|
|
deploy:
|
2023-02-27 10:52:47 +01:00
|
|
|
description: Deploy artifacts
|
2023-02-22 14:51:19 +01:00
|
|
|
required: true
|
|
|
|
type: boolean
|
|
|
|
default: true
|
2023-08-08 22:59:58 +02:00
|
|
|
run-name: Element ${{ inputs.mode != 'release' && github.event_name != 'release' && 'Nightly' || 'Desktop' }}
|
2023-03-02 17:54:57 +01:00
|
|
|
concurrency: ${{ github.workflow }}
|
2023-01-31 14:22:30 +01:00
|
|
|
env:
|
2023-04-14 12:30:14 +02:00
|
|
|
R2_BUCKET: ${{ vars.R2_BUCKET }}
|
2024-11-22 11:18:33 +01:00
|
|
|
permissions: {} # Uses ELEMENT_BOT_TOKEN
|
2023-01-31 14:22:30 +01:00
|
|
|
jobs:
|
2023-02-22 14:51:19 +01:00
|
|
|
prepare:
|
|
|
|
uses: ./.github/workflows/build_prepare.yaml
|
2024-11-22 11:18:33 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2023-02-22 14:51:19 +01:00
|
|
|
with:
|
2023-08-04 10:12:53 +02:00
|
|
|
config: element.io/${{ inputs.mode || (github.event_name == 'release' && 'release') || 'nightly' }}
|
|
|
|
version: ${{ (inputs.mode != 'release' && github.event_name != 'release') && 'develop' || '' }}
|
|
|
|
nightly: ${{ inputs.mode != 'release' && github.event_name != 'release' }}
|
2024-01-17 16:23:11 +01:00
|
|
|
deploy: ${{ inputs.deploy || (github.event_name != 'workflow_dispatch' && github.event.release.prerelease != true) }}
|
2023-02-22 14:51:19 +01:00
|
|
|
secrets:
|
|
|
|
CF_R2_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
|
|
|
|
CF_R2_TOKEN: ${{ secrets.CF_R2_TOKEN }}
|
2023-01-31 14:22:30 +01:00
|
|
|
|
2023-08-03 17:32:53 +02:00
|
|
|
windows:
|
|
|
|
if: github.event_name != 'workflow_dispatch' || inputs.windows
|
2023-02-22 14:51:19 +01:00
|
|
|
needs: prepare
|
2023-08-03 17:32:53 +02:00
|
|
|
name: Windows ${{ matrix.arch }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-01-08 13:40:59 +01:00
|
|
|
arch: [ia32, x64]
|
2023-02-22 14:51:19 +01:00
|
|
|
uses: ./.github/workflows/build_windows.yaml
|
|
|
|
secrets: inherit
|
|
|
|
with:
|
|
|
|
sign: true
|
2023-08-03 17:32:53 +02:00
|
|
|
arch: ${{ matrix.arch }}
|
|
|
|
version: ${{ needs.prepare.outputs.nightly-version }}
|
2023-02-20 13:09:45 +01:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
macos:
|
|
|
|
if: github.event_name != 'workflow_dispatch' || inputs.macos
|
|
|
|
needs: prepare
|
|
|
|
name: macOS
|
|
|
|
uses: ./.github/workflows/build_macos.yaml
|
|
|
|
secrets: inherit
|
2023-01-31 14:22:30 +01:00
|
|
|
with:
|
2023-02-22 14:51:19 +01:00
|
|
|
sign: true
|
2023-08-04 10:12:53 +02:00
|
|
|
base-url: https://packages.element.io/${{ needs.prepare.outputs.packages-dir }}
|
2023-08-03 17:32:53 +02:00
|
|
|
version: ${{ needs.prepare.outputs.nightly-version }}
|
2023-01-31 14:22:30 +01:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
linux:
|
2023-02-20 13:09:45 +01:00
|
|
|
if: github.event_name != 'workflow_dispatch' || inputs.linux
|
2023-02-22 14:51:19 +01:00
|
|
|
needs: prepare
|
2024-01-08 13:40:59 +01:00
|
|
|
name: Linux ${{ matrix.arch }} (sqlcipher ${{ matrix.sqlcipher }})
|
2023-04-26 17:07:20 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
arch: [amd64, arm64]
|
2024-06-11 14:04:56 +02:00
|
|
|
sqlcipher: [static]
|
2023-02-22 14:51:19 +01:00
|
|
|
uses: ./.github/workflows/build_linux.yaml
|
|
|
|
with:
|
2023-04-26 17:07:20 +02:00
|
|
|
arch: ${{ matrix.arch }}
|
2023-08-04 10:12:53 +02:00
|
|
|
config: ${{ needs.prepare.outputs.config }}
|
2024-01-08 13:40:59 +01:00
|
|
|
sqlcipher: ${{ matrix.sqlcipher }}
|
2023-08-03 17:32:53 +02:00
|
|
|
version: ${{ needs.prepare.outputs.nightly-version }}
|
2023-03-31 12:00:30 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
deploy:
|
|
|
|
needs:
|
2023-08-04 10:12:53 +02:00
|
|
|
- prepare
|
2023-02-22 14:51:19 +01:00
|
|
|
- macos
|
2023-02-27 10:52:47 +01:00
|
|
|
- linux
|
2023-08-03 17:32:53 +02:00
|
|
|
- windows
|
2024-10-17 10:46:02 +02:00
|
|
|
runs-on: ubuntu-24.04
|
2024-01-24 17:33:37 +01:00
|
|
|
name: ${{ needs.prepare.outputs.deploy == 'true' && 'Deploy' || 'Deploy (dry-run)' }}
|
2024-05-08 11:12:28 +02:00
|
|
|
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
|
2024-01-24 17:33:37 +01:00
|
|
|
environment: ${{ needs.prepare.outputs.deploy == 'true' && 'packages.element.io' || '' }}
|
2023-02-22 14:51:19 +01:00
|
|
|
steps:
|
|
|
|
- name: Download artifacts
|
2024-01-08 13:40:59 +01:00
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
|
|
|
|
- name: Prepare artifacts for deployment
|
|
|
|
run: |
|
|
|
|
# Windows
|
|
|
|
for arch in x64 ia32 arm64
|
|
|
|
do
|
|
|
|
if [ -d "win-$arch" ]; then
|
|
|
|
mkdir -p packages.element.io/{install,update}/win32/$arch
|
|
|
|
mv win-$arch/squirrel-windows*/*.exe "packages.element.io/install/win32/$arch/"
|
|
|
|
mv win-$arch/squirrel-windows*/*.nupkg "packages.element.io/update/win32/$arch/"
|
|
|
|
mv win-$arch/squirrel-windows*/RELEASES "packages.element.io/update/win32/$arch/"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# macOS
|
|
|
|
if [ -d macos ]; then
|
|
|
|
mkdir -p packages.element.io/{install,update}/macos
|
|
|
|
mv macos/*.dmg packages.element.io/install/macos/
|
|
|
|
mv macos/*-mac.zip packages.element.io/update/macos/
|
|
|
|
mv macos/*.json packages.element.io/update/macos/
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Linux
|
|
|
|
if [ -d linux-amd64-sqlcipher-static ]; then
|
|
|
|
mkdir -p packages.element.io/install/linux/glibc-x86-64
|
|
|
|
mv linux-amd64-sqlcipher-static/*.tar.gz packages.element.io/install/linux/glibc-x86-64
|
|
|
|
fi
|
2024-05-15 00:13:03 +02:00
|
|
|
if [ -d linux-arm64-sqlcipher-static ]; then
|
|
|
|
mkdir -p packages.element.io/install/linux/glibc-aarch64
|
|
|
|
mv linux-arm64-sqlcipher-static/*.tar.gz packages.element.io/install/linux/glibc-aarch64
|
|
|
|
fi
|
2024-01-08 13:40:59 +01:00
|
|
|
|
|
|
|
# We don't wish to store the installer for every nightly ever, so we only keep the latest
|
|
|
|
- name: "[Nightly] Strip version from installer file"
|
|
|
|
if: needs.prepare.outputs.nightly-version != ''
|
|
|
|
run: |
|
|
|
|
# Windows
|
|
|
|
for arch in x64 ia32 arm64
|
|
|
|
do
|
|
|
|
[ -d "win-$arch" ] && mv packages.element.io/install/win32/$arch/{*,"Element Nightly Setup"}.exe
|
|
|
|
done
|
|
|
|
|
|
|
|
# macOS
|
|
|
|
[ -d macos ] && mv packages.element.io/install/macos/{*,"Element Nightly"}.dmg
|
|
|
|
|
|
|
|
# Linux
|
|
|
|
[ -d linux-amd64-sqlcipher-static ] && mv packages.element.io/install/linux/glibc-x86-64/{*,element-desktop-nightly}.tar.gz
|
2024-05-15 00:13:03 +02:00
|
|
|
[ -d linux-arm64-sqlcipher-static ] && mv packages.element.io/install/linux/glibc-aarch64/{*,element-desktop-nightly}.tar.gz
|
2024-01-08 13:40:59 +01:00
|
|
|
|
|
|
|
- name: "[Release] Prepare release latest symlink"
|
|
|
|
if: needs.prepare.outputs.nightly-version == ''
|
|
|
|
run: |
|
|
|
|
# Windows
|
|
|
|
for arch in x64 ia32 arm64
|
|
|
|
do
|
2024-01-16 20:53:47 +01:00
|
|
|
if [ -d "win-$arch" ]; then
|
|
|
|
pushd packages.element.io/install/win32/$arch
|
|
|
|
ln -s "$(find . -type f -iname "*.exe" | xargs -0 -n1 -- basename)" "Element Setup.exe"
|
|
|
|
popd
|
|
|
|
fi
|
2024-01-08 13:40:59 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
# macOS
|
2024-01-16 20:53:47 +01:00
|
|
|
if [ -d macos ]; then
|
|
|
|
pushd packages.element.io/install/macos
|
|
|
|
ln -s "$(find . -type f -iname "*.dmg" | xargs -0 -n1 -- basename)" "Element.dmg"
|
|
|
|
popd
|
|
|
|
fi
|
2024-01-08 13:40:59 +01:00
|
|
|
|
|
|
|
# Linux
|
2024-01-16 20:53:47 +01:00
|
|
|
if [ -d linux-amd64-sqlcipher-static ]; then
|
2024-01-16 22:08:00 +01:00
|
|
|
pushd packages.element.io/install/linux/glibc-x86-64
|
2024-01-16 20:53:47 +01:00
|
|
|
ln -s "$(find . -type f -iname "*.tar.gz" | xargs -0 -n1 -- basename)" "element-desktop.tar.gz"
|
|
|
|
popd
|
|
|
|
fi
|
2024-05-15 00:13:03 +02:00
|
|
|
if [ -d linux-arm64-sqlcipher-static ]; then
|
|
|
|
pushd packages.element.io/install/linux/glibc-aarch64
|
|
|
|
ln -s "$(find . -type f -iname "*.tar.gz" | xargs -0 -n1 -- basename)" "element-desktop.tar.gz"
|
|
|
|
popd
|
|
|
|
fi
|
2023-02-22 14:51:19 +01:00
|
|
|
|
2024-01-17 16:23:11 +01:00
|
|
|
- name: Stash packages.element.io
|
2024-01-24 17:33:37 +01:00
|
|
|
if: needs.prepare.outputs.deploy == 'false'
|
2024-01-17 16:23:11 +01:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: packages.element.io
|
|
|
|
path: packages.element.io
|
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
- name: Deploy artifacts
|
2024-01-24 17:33:37 +01:00
|
|
|
if: needs.prepare.outputs.deploy == 'true'
|
2023-02-22 14:51:19 +01:00
|
|
|
run: |
|
|
|
|
aws s3 cp --recursive packages.element.io/ s3://$R2_BUCKET/$DEPLOYMENT_DIR --endpoint-url $R2_URL --region auto
|
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_R2_TOKEN }}
|
2023-04-14 12:30:14 +02:00
|
|
|
R2_URL: ${{ vars.CF_R2_S3_API }}
|
2023-08-04 10:12:53 +02:00
|
|
|
DEPLOYMENT_DIR: ${{ needs.prepare.outputs.packages-dir }}
|
2023-03-02 17:54:57 +01:00
|
|
|
|
2023-04-14 12:30:14 +02:00
|
|
|
- name: Notify packages.element.io of new files
|
2024-01-24 17:33:37 +01:00
|
|
|
if: needs.prepare.outputs.deploy == 'true'
|
2024-02-02 18:41:10 +01:00
|
|
|
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3
|
2023-04-14 12:30:14 +02:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
2023-12-13 11:02:45 +01:00
|
|
|
repository: element-hq/packages.element.io
|
2023-04-14 12:30:14 +02:00
|
|
|
event-type: packages-index
|
|
|
|
|
2023-11-22 09:31:25 +01:00
|
|
|
- name: Find debs
|
|
|
|
id: deb
|
2023-11-23 09:21:09 +01:00
|
|
|
if: needs.linux.result == 'success'
|
2023-11-22 09:31:25 +01:00
|
|
|
run: |
|
|
|
|
for arch in amd64 arm64
|
|
|
|
do
|
2024-06-11 14:04:56 +02:00
|
|
|
echo "$arch=$(ls linux-$arch-sqlcipher-static/*.deb | tail -n1)" >> $GITHUB_OUTPUT
|
2023-11-22 09:31:25 +01:00
|
|
|
done
|
|
|
|
|
2024-01-17 16:23:11 +01:00
|
|
|
- name: Stash debs
|
2024-01-25 16:16:46 +01:00
|
|
|
if: needs.prepare.outputs.deploy == 'false' && needs.linux.result == 'success'
|
2024-01-17 16:23:11 +01:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: debs
|
|
|
|
path: |
|
|
|
|
${{ steps.deb.outputs.amd64 }}
|
|
|
|
${{ steps.deb.outputs.arm64 }}
|
|
|
|
|
2023-11-22 09:31:25 +01:00
|
|
|
- name: Publish amd64 deb to packages.element.io
|
2023-12-13 11:02:45 +01:00
|
|
|
uses: element-hq/packages.element.io@master
|
2024-01-24 17:33:37 +01:00
|
|
|
if: needs.prepare.outputs.deploy == 'true' && needs.linux.result == 'success'
|
2023-11-22 09:31:25 +01:00
|
|
|
with:
|
|
|
|
file: ${{ steps.deb.outputs.amd64 }}
|
|
|
|
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
|
|
|
bucket-api: ${{ vars.CF_R2_S3_API }}
|
|
|
|
bucket-key-id: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
|
|
|
|
bucket-access-key: ${{ secrets.CF_R2_TOKEN }}
|
|
|
|
|
|
|
|
- name: Publish arm64 deb to packages.element.io
|
2023-12-13 11:02:45 +01:00
|
|
|
uses: element-hq/packages.element.io@master
|
2024-01-24 17:33:37 +01:00
|
|
|
if: needs.prepare.outputs.deploy == 'true' && needs.linux.result == 'success'
|
2023-11-22 09:31:25 +01:00
|
|
|
with:
|
|
|
|
file: ${{ steps.deb.outputs.arm64 }}
|
|
|
|
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
|
|
|
bucket-api: ${{ vars.CF_R2_S3_API }}
|
|
|
|
bucket-key-id: ${{ secrets.CF_R2_ACCESS_KEY_ID }}
|
|
|
|
bucket-access-key: ${{ secrets.CF_R2_TOKEN }}
|
2024-04-15 18:33:30 +02:00
|
|
|
|
|
|
|
deploy-ess:
|
|
|
|
needs: deploy
|
2024-10-17 10:46:02 +02:00
|
|
|
runs-on: ubuntu-24.04
|
2024-04-15 18:33:30 +02:00
|
|
|
name: Deploy builds to ESS
|
|
|
|
if: needs.prepare.outputs.deploy == 'true' && github.event_name == 'release'
|
|
|
|
env:
|
|
|
|
BUCKET_NAME: "element-desktop-msi.onprem.element.io"
|
|
|
|
AWS_REGION: "eu-central-1"
|
|
|
|
permissions:
|
|
|
|
id-token: write # This is required for requesting the JWT
|
|
|
|
steps:
|
|
|
|
- name: Configure AWS credentials
|
2024-04-16 15:54:43 +02:00
|
|
|
uses: aws-actions/configure-aws-credentials@v4
|
2024-04-15 18:33:30 +02:00
|
|
|
with:
|
|
|
|
role-to-assume: arn:aws:iam::264135176173:role/Push-ElementDesktop-MSI
|
|
|
|
role-session-name: githubaction-run-${{ github.run_id }}
|
|
|
|
aws-region: ${{ env.AWS_REGION }}
|
|
|
|
|
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
pattern: win-*
|
|
|
|
|
|
|
|
- name: Copy files to S3
|
|
|
|
run: |
|
|
|
|
PREFIX="${VERSION%.*}"
|
|
|
|
for file in win-*/*.msi; do
|
|
|
|
filename=$(basename "$file")
|
|
|
|
aws s3 cp "$file" "s3://${{ env.BUCKET_NAME }}/$PREFIX/$filename"
|
|
|
|
done
|
|
|
|
env:
|
|
|
|
VERSION: ${{ github.event.release.tag_name }}
|