Packaging #126
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Packaging | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- package | |
tags: | |
- '*' | |
env: | |
FORCE_COLOR: 1 | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-13 | |
- ubuntu-22.04 | |
- windows-2022 | |
host: | |
- x64 | |
target: | |
- x64 | |
node: | |
- 18 | |
include: | |
- os: macos-14 | |
node: 18 | |
host: arm64 | |
target: arm64 | |
- os: windows-2022 | |
node: 18 | |
host: x64 | |
target: x86 | |
name: ${{ matrix.os }} (node=${{ matrix.node }}, host=${{ matrix.host }}, target=${{ matrix.target }}) | |
steps: | |
- name: Set up bash association | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
ls | |
ls "c:\\" | |
ls "c:\\Program Files" | |
ls "c:\\Program Files/Git" | |
ls "c:\\Program Files/Git/bin" | |
cmd /c assoc .sh=bashscript | |
cmd /c ftype bashscript="%ProgramFiles%\Git\bin\bash.exe" "%1" | |
cmd /c ftype | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Submodule cleanup fix # See https://github.com/actions/checkout/issues/358 | |
run: | | |
git submodule foreach --recursive git clean -ffdx | |
git submodule foreach --recursive git reset --hard | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: | | |
node_modules | |
core/node_modules | |
key: ${{ matrix.os }}-${{ matrix.target }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ matrix.os }}-${{ matrix.target }}-yarn- | |
- name: Install dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn install --network-timeout 300000 | |
- name: Fix Windows x86 sqlite3 binding | |
if: steps.yarn-cache.outputs.cache-hit != 'true' && startsWith(matrix.os, 'windows') && matrix.target == 'x86' | |
run: yarn upgrade sqlite3 | |
# Prebuilt binding is for x64. We must build from source for x86 target. | |
# See: | |
# https://stackoverflow.com/questions/72553650/how-to-get-node-sqlite3-working-on-mac-m1 | |
# https://yarnpkg.com/lang/en/docs/envvars/#toc-npm-config | |
env: | |
npm_config_build_from_source: true | |
npm_config_target_arch: ia32 | |
npm_config_fallback_to_build: true | |
- name: Hooks and crooks | |
run: yarn run setup | |
env: | |
RUN_OS: ${{ matrix.os }} | |
RUN_ARCH: ${{ matrix.target }} | |
- name: Build | |
run: yarn run build | |
- name: Test | |
run: yarn run test | |
- name: Package | |
# github endpoints hang up quite a bit, add one retry. | |
run: yarn run electron:ci || yarn run electron:ci | |
env: | |
TARGET_ARCH: ${{ matrix.target }} | |
GITHUB_TOKEN: ${{ github.token }} | |
DEBUG: electron-builder | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
CSC_LINK: ${{ secrets.CSC_LINK }} | |
- name: Upload Windows portable build | |
if: startsWith(matrix.os, 'windows') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-portable-${{ matrix.target }} | |
path: dist/grist-desktop-*.zip | |
if-no-files-found: "error" | |
- name: Upload Windows installer build | |
if: startsWith(matrix.os, 'windows') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-portable-${{ matrix.target }} | |
path: dist/grist-desktop-*.exe | |
if-no-files-found: "error" | |
- name: Upload Linux build | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-${{ matrix.target }} | |
path: dist/grist-desktop-*.AppImage | |
if-no-files-found: "error" | |
- name: Upload macOS build | |
if: startsWith(matrix.os, 'macos') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-${{ matrix.target }} | |
path: dist/grist-desktop-*.dmg | |
if-no-files-found: "error" |