macintosh.js/.github/workflows/build.yml

125 lines
4.4 KiB
YAML
Raw Normal View History

2020-07-28 01:04:24 +00:00
name: Build & Release
on:
push:
branches:
2020-08-02 19:55:30 +00:00
- master
2020-07-28 01:04:24 +00:00
tags:
- v*
pull_request:
jobs:
lint:
2023-03-14 20:59:49 +00:00
runs-on: ubuntu-20.04
2020-07-28 01:04:24 +00:00
steps:
2023-03-13 23:41:10 +00:00
- uses: actions/checkout@v3
2020-07-28 01:04:24 +00:00
- name: Setup Node.js
2023-03-13 23:41:10 +00:00
uses: actions/setup-node@v3
2020-07-28 01:04:24 +00:00
with:
2023-03-13 23:41:10 +00:00
node-version: lts/*
2020-07-28 01:04:24 +00:00
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
2023-03-13 23:41:10 +00:00
- uses: actions/cache@v3
2020-07-28 01:04:24 +00:00
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
2023-03-14 20:48:53 +00:00
run: yarn --frozen-lockfile
2020-07-28 01:04:24 +00:00
- name: lint
run: yarn lint
build:
needs: lint
2023-03-14 20:48:53 +00:00
name: Build (${{ matrix.os }} - ${{ matrix.arch }})
2020-07-28 01:19:41 +00:00
runs-on: ${{ matrix.os }}
2020-07-28 01:04:24 +00:00
strategy:
matrix:
2023-03-14 00:14:29 +00:00
# Build for supported platforms
# https://github.com/electron/electron-packager/blob/ebcbd439ff3e0f6f92fa880ff28a8670a9bcf2ab/src/targets.js#L9
# 32-bit Linux unsupported as of 2019: https://www.electronjs.org/blog/linux-32bit-support
2023-03-14 20:59:49 +00:00
os: [ macOS-latest, ubuntu-20.04, windows-latest ]
2023-03-14 00:14:29 +00:00
arch: [ x64, arm64 ]
include:
- os: windows-latest
arch: ia32
2023-03-14 20:59:49 +00:00
- os: ubuntu-20.04
2023-03-14 00:14:29 +00:00
arch: armv7l
# Publishing artifacts for multiple Windows architectures has
# a bug which can cause the wrong architecture to be downloaded
# for an update, so until that is fixed, only build Windows x64
exclude:
- os: windows-latest
arch: arm64
2023-03-14 20:48:53 +00:00
2020-07-28 01:04:24 +00:00
steps:
2023-03-13 23:41:10 +00:00
- uses: actions/checkout@v3
2020-07-28 01:04:24 +00:00
- name: Setup Node.js
2023-03-13 23:41:10 +00:00
uses: actions/setup-node@v3
2020-07-28 01:04:24 +00:00
with:
2023-03-13 23:41:10 +00:00
node-version: lts/*
2020-07-28 01:04:24 +00:00
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
2023-03-13 23:41:10 +00:00
- uses: actions/cache@v3
2020-07-28 01:19:41 +00:00
if: matrix.os != 'macOS-latest'
2020-07-28 01:04:24 +00:00
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set MacOS signing certs
2020-07-28 01:12:27 +00:00
if: matrix.os == 'macOS-latest'
2020-07-28 01:19:41 +00:00
run: chmod +x tools/add-macos-cert.sh && ./tools/add-macos-cert.sh
2020-07-28 01:04:24 +00:00
env:
2020-07-28 01:31:52 +00:00
MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
2020-07-28 01:04:24 +00:00
- name: Set Windows signing certificate
2020-08-02 20:05:34 +00:00
if: matrix.os == 'windows-latest'
continue-on-error: true
2020-07-28 01:04:24 +00:00
id: write_file
uses: timheuer/base64-to-file@v1
with:
fileName: 'win-certificate.pfx'
encodedString: ${{ secrets.WINDOWS_CODESIGN_P12 }}
2020-07-28 03:00:57 +00:00
- name: Download disk image (ps1)
2020-07-28 03:24:17 +00:00
run: tools/download-disk.ps1
2020-07-28 04:06:36 +00:00
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/')
2020-07-28 03:24:17 +00:00
env:
DISK_URL: ${{ secrets.DISK_URL }}
2020-07-28 03:00:57 +00:00
- name: Download disk image (sh)
run: chmod +x tools/download-disk.sh && ./tools/download-disk.sh
2020-07-28 04:06:36 +00:00
if: matrix.os != 'windows-latest' && startsWith(github.ref, 'refs/tags/')
2020-07-28 03:24:17 +00:00
env:
DISK_URL: ${{ secrets.DISK_URL }}
2020-07-28 01:04:24 +00:00
- name: Install
run: yarn
- name: Make
2020-07-28 04:42:46 +00:00
if: startsWith(github.ref, 'refs/tags/')
2023-03-14 00:20:19 +00:00
run: yarn make --arch=${{ matrix.arch }}
2020-07-28 01:04:24 +00:00
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
WINDOWS_CODESIGN_FILE: ${{ steps.write_file.outputs.filePath }}
WINDOWS_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
2020-07-28 04:06:36 +00:00
# - name: Archive production artifacts
# uses: actions/upload-artifact@v2
# with:
# name: ${{ matrix.os }}
# path: out/make/**/*
2020-07-28 01:04:24 +00:00
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
2020-07-28 01:04:24 +00:00
files: |
2020-07-28 01:12:27 +00:00
out/**/*.deb
out/**/*.dmg
2020-07-28 04:17:39 +00:00
out/**/*setup*.exe
2020-07-28 01:12:27 +00:00
out/**/*.rpm
out/**/*.zip