2022-12-13 14:12:40 +00:00
|
|
|
# This workflow relies on actions/cache to store the hak dependency artifacts as they take a long time to build
|
|
|
|
# Due to this extra care must be taken to only ever run all build_* scripts against the same branch to ensure
|
|
|
|
# the correct cache scoping, and additional care must be taken to not run untrusted actions on the develop branch.
|
2022-11-11 15:15:21 +00:00
|
|
|
on:
|
2022-12-15 11:00:58 +00:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
2023-03-07 15:53:53 +00:00
|
|
|
config:
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
description: "The config directory to use"
|
2023-02-20 12:09:45 +00:00
|
|
|
version:
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
description: "Version string to override the one in package.json, used for non-release builds"
|
2022-12-15 11:00:58 +00:00
|
|
|
sqlcipher:
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
description: "How to link sqlcipher, one of 'system' | 'static'"
|
2023-03-31 10:00:30 +00:00
|
|
|
deploy-mode:
|
|
|
|
type: boolean
|
|
|
|
required: false
|
|
|
|
description: "Whether to arrange artifacts in the arrangement needed for deployment, skipping unrelated ones"
|
2022-11-11 15:15:21 +00:00
|
|
|
jobs:
|
2022-12-15 11:00:58 +00:00
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
2023-03-30 13:22:58 +00:00
|
|
|
container:
|
|
|
|
image: ghcr.io/vector-im/element-desktop-dockerbuild:t3chguy-dockerbuild
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
2022-12-15 11:00:58 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-11-11 15:15:21 +00:00
|
|
|
|
2022-12-15 11:00:58 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: webapp
|
2022-11-11 15:15:21 +00:00
|
|
|
|
2022-12-15 11:00:58 +00:00
|
|
|
- name: Cache .hak
|
|
|
|
id: cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('hakDependencies.json', 'electronVersion') }}
|
|
|
|
path: |
|
|
|
|
./.hak
|
2022-11-11 15:15:21 +00:00
|
|
|
|
2022-12-15 11:00:58 +00:00
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
cache: "yarn"
|
2023-03-30 13:22:58 +00:00
|
|
|
env:
|
|
|
|
# Workaround for https://github.com/actions/setup-node/issues/317
|
|
|
|
FORCE_COLOR: 0
|
2022-11-11 15:15:21 +00:00
|
|
|
|
2022-12-15 11:00:58 +00:00
|
|
|
# Does not need branch matching as only analyses this layer
|
|
|
|
- name: Install Deps
|
2023-03-31 15:17:43 +00:00
|
|
|
run: "yarn install --frozen-lockfile"
|
2022-11-11 15:15:21 +00:00
|
|
|
|
2022-12-15 11:00:58 +00:00
|
|
|
- name: Build Natives
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
run: "yarn build:native"
|
|
|
|
env:
|
|
|
|
SQLCIPHER_STATIC: ${{ inputs.sqlcipher == 'static' && '1' || '' }}
|
2022-11-11 15:15:21 +00:00
|
|
|
|
2023-02-22 13:51:19 +00:00
|
|
|
- name: "[Nightly] Resolve version"
|
2023-02-20 12:09:45 +00:00
|
|
|
id: nightly
|
|
|
|
if: inputs.version != ''
|
|
|
|
run: |
|
|
|
|
echo "config-args=--nightly '${{ inputs.version }}'" >> $GITHUB_OUTPUT
|
|
|
|
|
2023-03-07 15:53:53 +00:00
|
|
|
- name: Generate debian files and arguments
|
|
|
|
id: debian
|
2023-02-20 12:09:45 +00:00
|
|
|
run: |
|
2023-03-07 15:53:53 +00:00
|
|
|
if [ -f changelog.Debian ]; then
|
|
|
|
echo "config-args=--deb-changelog changelog.Debian" >> $GITHUB_OUTPUT
|
|
|
|
fi
|
2023-03-30 13:22:58 +00:00
|
|
|
|
2023-03-07 15:53:53 +00:00
|
|
|
cp "$DIR/control.template" debcontrol
|
2023-02-20 12:09:45 +00:00
|
|
|
VERSION=${INPUT_VERSION:-$(cat package.json | jq -r .version)}
|
|
|
|
echo "Version: $VERSION" >> debcontrol
|
2023-03-07 15:53:53 +00:00
|
|
|
env:
|
|
|
|
DIR: ${{ inputs.config }}
|
|
|
|
INPUT_VERSION: ${{ inputs.version }}
|
2023-02-20 12:09:45 +00:00
|
|
|
|
2022-12-15 11:00:58 +00:00
|
|
|
- name: Build App
|
2023-02-20 12:09:45 +00:00
|
|
|
run: |
|
2023-03-30 13:22:58 +00:00
|
|
|
npx ts-node scripts/generate-builder-config.ts \
|
2023-03-07 15:53:53 +00:00
|
|
|
${{ steps.nightly.outputs.config-args }} \
|
|
|
|
${{ steps.debian.outputs.config-args }} \
|
|
|
|
--deb-custom-control=debcontrol
|
2023-02-20 12:09:45 +00:00
|
|
|
yarn build --publish never -l --config electron-builder.json
|
2022-11-11 15:15:21 +00:00
|
|
|
|
2023-03-31 10:00:30 +00:00
|
|
|
- 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"
|
|
|
|
|
2022-12-15 11:00:58 +00:00
|
|
|
- name: Upload Artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-03-31 10:00:30 +00:00
|
|
|
name: ${{ inputs.deploy-mode && 'packages.element.io' || format('linux-sqlcipher-{0}', inputs.sqlcipher) }}
|
2023-03-02 16:54:57 +00:00
|
|
|
path: dist
|
2022-12-15 11:00:58 +00:00
|
|
|
retention-days: 1
|