From 56da2db2395f205cb4c41830ce0c687a5fa83493 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 30 Sep 2024 19:18:07 +1300 Subject: [PATCH] GHA: added a CD script. --- .github/workflows/cd.yml | 50 ++++++++++++++++++++++++++++++++++++++ electron-builder.yml | 52 ++++++++++++---------------------------- 2 files changed, 65 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..641b681 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,50 @@ +name: CD + +on: + push: + branches: [ main ] + release: + types: [ created ] + workflow_dispatch: + +jobs: + cd: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: Windows + os: windows-latest + script: win + - name: Linux + os: ubuntu-latest + script: linux + - name: macOS (Intel) + os: macos-13 + script: mac + - name: macOS (ARM) + os: macos-latest + script: mac + steps: + - name: Check out OpenCOR + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - name: Setup Yarn + run: npm install -g yarn + - name: Build OpenCOR + run: | + yarn + yarn build:${{ matrix.script }} + - name: Remove blockmap files + shell: bash + run: find ./dist -name '*.blockmap' -delete + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.name }} + path: ./dist/OpenCOR-*.* diff --git a/electron-builder.yml b/electron-builder.yml index 9a6703e..f54c982 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -1,45 +1,23 @@ -appId: ws.opencor +appId: ws.opencor.app productName: OpenCOR -directories: - buildResources: build -files: - - '!**/.vscode/*' - - '!src/*' - - '!electron.vite.config.{js,ts,mjs,cjs}' - - '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yml,dev-app-update.yml,CHANGELOG.md,README.md}' - - '!{.env,.env.*,.npmrc,pnpm-lock.yaml}' - - '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}' -asarUnpack: - - resources/** win: - executableName: OpenCOR + artifactName: ${productName}-${version}-Windows.${ext} + target: + - nsis + - zip nsis: - artifactName: ${name}-${version}-setup.${ext} - shortcutName: ${productName} + artifactName: ${productName}-${version}.${ext} uninstallDisplayName: ${productName} - createDesktopShortcut: always -mac: - entitlementsInherit: build/entitlements.mac.plist - extendInfo: - - NSCameraUsageDescription: Application requests access to the device's camera. - - NSMicrophoneUsageDescription: Application requests access to the device's microphone. - - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. - - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. - notarize: false -dmg: - artifactName: ${name}-${version}.${ext} linux: + artifactName: ${productName}-${version}-Linux.${ext} + executableName: OpenCOR + target: + - tar.gz +mac: + artifactName: ${productName}-${version}-macOS-${arch}.${ext} target: - - AppImage - - snap - - deb - maintainer: electronjs.org - category: Utility -appImage: - artifactName: ${name}-${version}.${ext} -npmRebuild: false + - pkg + - zip publish: provider: generic - url: https://example.com/auto-updates -electronDownload: - mirror: https://npmmirror.com/mirrors/electron/ + url: https://opencor.ws/auto-updates