refactor build-enjoy-app workflow

This commit is contained in:
an-lee
2024-03-19 08:26:01 +08:00
parent b5d1952f56
commit f7639b69cd
4 changed files with 119 additions and 15 deletions

View File

@@ -0,0 +1,35 @@
name: Build Enjoy App (Linux)
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Make
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
run: yarn run enjoy:make
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Enjoy-${{ runner.os }}-x64-build-${{ github.sha }}
path: |
enjoy/out/make/**/*.deb
enjoy/out/make/**/*.rpm

View File

@@ -1,14 +1,10 @@
name: Build Enjoy App
name: Build Enjoy App (macos-12)
on:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-14, windows-latest, ubuntu-latest]
runs-on: macos-12
steps:
- uses: actions/checkout@v4
@@ -20,13 +16,12 @@ jobs:
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: "**/node_modules"
key: ${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Install Apple certificate
if: contains(matrix.os, 'macos')
env:
MACOS_CERTIFICATE_APPLICATION_BASE64: ${{ secrets.MACOS_CERTIFICATE_APPLICATION_BASE64 }}
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
@@ -35,17 +30,14 @@ jobs:
- name: Make
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
APPLE_ID: ${{ runner.os == 'macOS' && secrets.APPLE_ID || '' }}
APPLE_APP_PASSWORD: ${{ runner.os == 'macOS' && secrets.APPLE_APP_PASSWORD || '' }}
APPLE_TEAM_ID: ${{ runner.os == 'macOS' && secrets.APPLE_TEAM_ID || '' }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: yarn run enjoy:make
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Enjoy-${{ runner.os }}-${{ matrix.os == 'macos-14' && 'arm64' || 'x64' }}-build-${{ github.sha }}
name: Enjoy-${{ runner.os }}-x64-build-${{ github.sha }}
path: |
enjoy/out/make/**/*.deb
enjoy/out/make/**/*.rpm
enjoy/out/make/**/*.exe
enjoy/out/make/**/*.dmg

View File

@@ -0,0 +1,43 @@
name: Build Enjoy App (macos-14)
on:
workflow_dispatch:
jobs:
build:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Install Apple certificate
env:
MACOS_CERTIFICATE_APPLICATION_BASE64: ${{ secrets.MACOS_CERTIFICATE_APPLICATION_BASE64 }}
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
run: ./enjoy/scripts/add-macos-cert.sh
- name: Make
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: yarn run enjoy:make
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Enjoy-${{ runner.os }}-arm64-build-${{ github.sha }}
path: |
enjoy/out/make/**/*.dmg

View File

@@ -0,0 +1,34 @@
name: Build Enjoy App (Windows)
on:
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Make
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
run: yarn run enjoy:make
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Enjoy-${{ runner.os }}-x64-build-${{ github.sha }}
path: |
enjoy/out/make/**/*.exe