2023-01-31 14:22:30 +01:00
|
|
|
name: Build and Deploy
|
|
|
|
on:
|
2023-02-22 14:51:19 +01:00
|
|
|
# Nightly build
|
|
|
|
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 }}
|
2023-01-31 14:22:30 +01:00
|
|
|
jobs:
|
2023-02-22 14:51:19 +01:00
|
|
|
prepare:
|
|
|
|
uses: ./.github/workflows/build_prepare.yaml
|
|
|
|
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' }}
|
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:
|
|
|
|
arch: [x86, x64]
|
2023-02-22 14:51:19 +01:00
|
|
|
uses: ./.github/workflows/build_windows.yaml
|
|
|
|
secrets: inherit
|
|
|
|
with:
|
|
|
|
sign: true
|
|
|
|
deploy-mode: 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
|
|
|
|
deploy-mode: 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-04-26 17:07:20 +02:00
|
|
|
# We do not put these calls into deploy-mode as we do not want it to add to the packages.element.io artifact
|
2023-03-31 12:00:30 +02:00
|
|
|
# We ship this build via reprepro only
|
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
|
2023-04-26 17:07:20 +02:00
|
|
|
name: Linux ${{ matrix.arch }} (sqlcipher system)
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
arch: [amd64, arm64]
|
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 }}
|
2023-02-22 14:51:19 +01:00
|
|
|
sqlcipher: system
|
2023-08-03 17:32:53 +02:00
|
|
|
version: ${{ needs.prepare.outputs.nightly-version }}
|
2023-02-20 13:09:45 +01:00
|
|
|
|
2023-03-31 12:00:30 +02:00
|
|
|
# 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:
|
2023-04-18 12:38:26 +02:00
|
|
|
arch: amd64
|
2023-03-31 12:00:30 +02:00
|
|
|
deploy-mode: true
|
2023-08-04 10:12:53 +02:00
|
|
|
config: ${{ needs.prepare.outputs.config }}
|
2023-03-31 12:00:30 +02:00
|
|
|
sqlcipher: static
|
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-03-31 12:00:30 +02:00
|
|
|
- linux_static
|
2023-08-03 17:32:53 +02:00
|
|
|
- windows
|
2023-02-22 14:51:19 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Deploy
|
2023-08-02 14:05:22 +02:00
|
|
|
if: |
|
2023-10-23 13:04:58 +02:00
|
|
|
always() && !failure() && !cancelled() && ((
|
2023-08-04 10:12:53 +02:00
|
|
|
github.event_name != 'workflow_dispatch' &&
|
|
|
|
github.event.release.prerelease != true
|
|
|
|
) || (
|
2023-10-23 13:04:58 +02:00
|
|
|
inputs.deploy && (inputs.macos || inputs.windows || inputs.linux)
|
|
|
|
))
|
2023-02-22 14:51:19 +01:00
|
|
|
environment: packages.element.io
|
|
|
|
steps:
|
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
|
|
|
|
- name: Deploy artifacts
|
|
|
|
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
|
2023-09-06 14:41:51 +02:00
|
|
|
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2
|
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
|
|
|
|
echo "$arch=$(ls linux-$arch-sqlcipher-system/*.deb | tail -n1)" >> $GITHUB_OUTPUT
|
|
|
|
done
|
|
|
|
|
|
|
|
- name: Publish amd64 deb to packages.element.io
|
2023-12-13 11:02:45 +01:00
|
|
|
uses: element-hq/packages.element.io@master
|
2023-11-23 09:21:09 +01:00
|
|
|
if: 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
|
2023-11-23 09:21:09 +01:00
|
|
|
if: 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 }}
|