145 lines
5.1 KiB
YAML
145 lines
5.1 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
arch: [arm64, amd64]
|
|
- os: macos-latest
|
|
arch: [arm64, amd64]
|
|
- os: windows-latest
|
|
arch: [arm64, amd64]
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Build Prepare (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential pkg-config
|
|
|
|
- name: Build Prepare (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew install python-setuptools
|
|
|
|
- name: Cert Prepare (macOS)
|
|
if: runner.os == 'macOS'
|
|
env:
|
|
MACOS_CERTIFICATE: ${{ secrets.CORP_MACOS_CERTIFICATE }}
|
|
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.CORP_MACOS_CERTIFICATE_PASSWORD }}
|
|
run: |
|
|
echo "find-identity"
|
|
security find-identity -p codesigning
|
|
echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
|
|
security create-keychain -p "" build.keychain
|
|
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
|
|
security list-keychains -s build.keychain
|
|
security set-keychain-settings -t 3600 -u build.keychain
|
|
security unlock-keychain -p "" build.keychain
|
|
echo "find-identity"
|
|
security find-identity -v -p codesigning build.keychain
|
|
echo "find-identity"
|
|
security find-identity -p codesigning
|
|
echo "set-key-partition-list"
|
|
security set-key-partition-list -S apple-tool:,apple: -s -k "" -l "Mac Developer ID Application: Xi'an Yanyi Information Technology Co., Ltd" -t private build.keychain
|
|
echo "export"
|
|
security export -k build.keychain -t certs -f x509 -p -o certificate.cer
|
|
echo "add-trusted-cert"
|
|
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain certificate.cer
|
|
echo "find-identity"
|
|
security find-identity -p codesigning
|
|
|
|
- name: Install Dependencies (Linux/macOS)
|
|
if: runner.os == 'Linux' || runner.os == 'macOS'
|
|
run: |
|
|
npm install --ignore-scripts
|
|
rm -rf node_modules/canvas
|
|
npx electron-builder install-app-deps
|
|
|
|
- name: Install Dependencies (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
npm install --ignore-scripts
|
|
if (Test-Path node_modules\canvas) { Remove-Item -Recurse -Force node_modules\canvas }
|
|
npx electron-builder install-app-deps
|
|
|
|
- name: init ( Windows )
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: bash ./scripts/init.sh
|
|
|
|
- name: init ( Linux/osx )
|
|
if: runner.os == 'Linux' || runner.os == 'macOS'
|
|
run: bash ./scripts/init.sh
|
|
|
|
- name: Build Release Files
|
|
run: npm run build
|
|
env:
|
|
DEBUG: "electron-notarize:*"
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
|
|
- name: Upload Artifact Windows
|
|
if: runner.os == 'Windows'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: windows-artifact
|
|
path: |
|
|
dist-release/*.exe
|
|
|
|
- name: Upload Artifact Macos
|
|
if: runner.os == 'macOS'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: macos-artifact
|
|
path: |
|
|
dist-release/*.dmg
|
|
|
|
- name: Upload Artifact Linux
|
|
if: runner.os == 'Linux'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: linux-artifact
|
|
path: |
|
|
dist-release/*.AppImage
|
|
dist-release/*.deb
|
|
|
|
# ── Notify ────────────────────────────────────────────────────────────────────
|
|
notify:
|
|
name: Notify
|
|
needs: [build]
|
|
runs-on: ubuntu-latest
|
|
if: success()
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Notify Webhook
|
|
run: |
|
|
NAME="${{ github.event.repository.name }}"
|
|
TYPE=$(echo "${{ github.workflow }}" | tr '[:upper:]' '[:lower:]')
|
|
VERSION=$(node -p "require('./package.json').version")
|
|
curl -X POST "${{ secrets.HOOK_URL }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"event\":\"${NAME}\",\"param\":{\"name\":\"${NAME}\",\"type\":\"${TYPE}\",\"version\":\"${VERSION}\"},\"data\":{\"name\":\"${NAME}\",\"type\":\"${TYPE}\",\"version\":\"${VERSION}\"}}"
|
|
|