You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/.github/workflows/build-binaries.yml

214 lines
8.3 KiB
YAML

# There is a fair bit of duplication here, but it is the best to save our github free minutes for now.
# We could save and restore cache to different jobs but that takes roughly 3 minutes to save,
# so better run them in parrallel instead.
name: Session Desktop
on:
push:
branches:
- master
- unstable
- 'release/**'
- 'ci/**'
pull_request:
branches:
- unstable
- 'release/**'
- 'ci/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# we want to publish on "push to master" only. When we don't want to publish, we want to upload artefacts
SHOULD_PUBLISH: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
# TODO Are we happy with this condition?
SHOULD_PUBLISH_ALPHA: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release') && contains(github.ref, '-alpha.') }}
jobs:
build_linux:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# this needs to be a valid target of https://www.electron.build/linux#target
pkg_to_build: ['deb', 'rpm', 'freebsd', 'AppImage']
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- run: git config --global core.autocrlf false
- name: Checkout git repo
uses: actions/checkout@v4
- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: ${{ matrix.pkg_to_build }}
- name: Lint Files
# no need to lint files on all platforms
run: yarn lint-full
- name: Enforce yarn.lock has no duplicates
# no need to dedup yarn.lock on all platforms
uses: ./actions/deduplicate_fail
# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
- name: Unit Test
run: yarn test
- name: Build but do not publish ${{ matrix.pkg_to_build }}
# we want this to run always, except on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
run: |
sed -i 's/"target": \["deb"\]/"target": "${{ matrix.pkg_to_build }}"/g' package.json && yarn build-release
- name: Upload artefacts ${{ matrix.pkg_to_build }}
# we want this to run always, except on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
uses: ./actions/upload_prod_artefacts
with:
upload_prefix: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.pkg_to_build }}
multiarch_build: 'false'
- name: Build & publish ${{ matrix.pkg_to_build }}
# we want this to run only when on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
run: |
sed -i 's/"target": \["deb"\]/"target": "${{ matrix.pkg_to_build }}"/g' package.json && yarn build-release-publish
build_windows:
runs-on: windows-2022
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- run: git config --global core.autocrlf false
- name: Checkout git repo
uses: actions/checkout@v4
- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: 'windows_x64'
# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
- name: Unit Test
run: yarn test
- name: Build but do not publish
# we want this to run always, except on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
run: yarn build-release
- name: Upload artefacts
# we want this to run always, except on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
uses: ./actions/upload_prod_artefacts
with:
upload_prefix: ${{ runner.os }}-${{ runner.arch }}
multiarch_build: 'false'
- name: Build & publish
# we want this to run only when on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
run: yarn build-release-publish # No other args needed for windows publish
# We want both arm64 and intel mac builds, and according to this https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources macos-14 and above is always arm64 and macos-13 is the last intel runner
# Note x64 builds made on an arm64 host will not bundle the native modules correctly https://github.com/electron-userland/electron-builder/issues/8646
build_mac_arm64:
runs-on: macos-14
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
SIGNING_APPLE_ID: ${{ secrets.SIGNING_APPLE_ID }}
SIGNING_APP_PASSWORD: ${{ secrets.SIGNING_APP_PASSWORD }}
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}
steps:
- run: git config --global core.autocrlf false
- name: Checkout git repo
uses: actions/checkout@v4
- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: mac-arm64
# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
- name: Unit Test
run: yarn test
- name: Build but do not publish ${{ runner.arch }}
# we want this to run always, except on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
run: |
source ./build/setup-mac-certificate.sh
yarn build-release --config.mac.bundleVersion=${{ github.ref }}
- name: Upload artefacts ${{ runner.arch }}
# we want this to run always, except on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
uses: ./actions/upload_prod_artefacts
with:
upload_prefix: mac-arm64
multiarch_build: 'true'
- name: Build & publish ${{ runner.arch }}
# we want this to run only when on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
run: |
source ./build/setup-mac-certificate.sh
yarn build-release-publish --config.mac.bundleVersion=${{ github.ref }}
build_mac_x64:
runs-on: macos-13
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
SIGNING_APPLE_ID: ${{ secrets.SIGNING_APPLE_ID }}
SIGNING_APP_PASSWORD: ${{ secrets.SIGNING_APP_PASSWORD }}
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}
steps:
- run: git config --global core.autocrlf false
- name: Checkout git repo
uses: actions/checkout@v4
- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: mac-x64
# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
- name: Unit Test
run: yarn test
- name: Build but do not publish ${{ runner.arch }}
# we want this to run always, except on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
run: |
source ./build/setup-mac-certificate.sh
yarn build-release --config.mac.bundleVersion=${{ github.ref }}
- name: Upload artefacts ${{ runner.arch }}
# we want this to run always, except on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
uses: ./actions/upload_prod_artefacts
with:
upload_prefix: mac-x64
multiarch_build: 'true'
- name: Build & publish ${{ runner.arch }}
# we want this to run only when on "push" to "master"
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
run: |
source ./build/setup-mac-certificate.sh
yarn build-release-publish --config.mac.bundleVersion=${{ github.ref }}