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

114 lines
3.9 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:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
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
run: yarn
- name: lint
run: yarn lint
build:
needs: lint
2020-07-28 01:19:41 +00:00
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
2020-07-28 01:04:24 +00:00
strategy:
matrix:
2020-07-28 01:19:41 +00:00
os: [ macOS-latest, ubuntu-latest, windows-latest ]
2020-07-28 01:04:24 +00:00
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
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 19:58:02 +00:00
if: ${{ matrix.os == 'windows-latest' }} && ${{ secrets.WINDOWS_CODESIGN_P12 }}
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/')
2020-07-28 01:04:24 +00:00
run: yarn make
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:42:46 +00:00
- name: Make (ia32)
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/')
run: yarn make -- --arch=ia32
env:
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