|
1 | | -name: build |
| 1 | +--- |
| 2 | +name: Application Build |
2 | 3 |
|
3 | 4 | on: |
4 | | - workflow_dispatch: |
5 | 5 | push: |
6 | | - # enable next line to limit branches to run |
7 | | - branches: ["main"] |
| 6 | + branches-ignore: |
| 7 | + - "release/*" |
| 8 | + tags-ignore: |
| 9 | + - "*" |
8 | 10 | pull_request: |
9 | | - # enable next line to limit branches to run |
10 | | - # branches: [ "main" ] |
11 | 11 |
|
12 | 12 | jobs: |
13 | 13 | build: |
| 14 | + env: |
| 15 | + UPDATE_FEED_OWNER: Dexus |
| 16 | + UPDATE_FEED_REPOSITORY: Deepnest |
| 17 | + BUILD_NUMBER: ${{ github.run_number }} |
| 18 | + PREBUILDS_ONLY: 1 |
14 | 19 | strategy: |
15 | 20 | matrix: |
16 | | - node-version: [20.x, 22.x] |
17 | | - os: [windows-2022, ubuntu-22.04] |
| 21 | + os: |
| 22 | + [ |
| 23 | + "ubuntu-24.04", |
| 24 | + "ubuntu-24.04-arm", |
| 25 | + "windows-latest", |
| 26 | + "macos-latest", |
| 27 | + "macos-13", |
| 28 | + ] |
| 29 | + arch: ["x64", "arm64"] |
| 30 | + target: ["", "mas"] |
| 31 | + exclude: |
| 32 | + - os: "ubuntu-24.04-arm" |
| 33 | + arch: "x64" |
| 34 | + - os: "ubuntu-24.04" |
| 35 | + arch: "arm64" |
| 36 | + - os: "macos-13" |
| 37 | + arch: "arm64" |
| 38 | + - os: "macos-latest" |
| 39 | + arch: "x64" |
| 40 | + # Exclude MAS target for non-macOS platforms |
| 41 | + - os: "ubuntu-24.04" |
| 42 | + target: "mas" |
| 43 | + - os: "ubuntu-24.04-arm" |
| 44 | + target: "mas" |
| 45 | + - os: "windows-latest" |
| 46 | + target: "mas" |
| 47 | + # # Include only one target for each macOS build to avoid duplicates |
| 48 | + - os: "macos-13" |
| 49 | + target: "mas" |
| 50 | + # - os: "macos-latest" |
| 51 | + # target: "" |
| 52 | + fail-fast: true |
| 53 | + |
18 | 54 | runs-on: ${{ matrix.os }} |
| 55 | + |
19 | 56 | steps: |
20 | | - - uses: actions/checkout@v4 |
21 | | - with: |
22 | | - submodules: recursive |
| 57 | + - name: Github checkout |
| 58 | + uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Install distribution dependencies |
| 61 | + shell: bash |
| 62 | + run: | |
| 63 | + if [[ "${{ matrix.os }}" == "ubuntu-24.04" || "${{ matrix.os }}" == "ubuntu-24.04-arm" ]]; then |
| 64 | + sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y flatpak flatpak-builder elfutils snapd libgl1 libglx-mesa0; |
| 65 | + flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo ; |
| 66 | + flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo ; |
| 67 | + flatpak update --appstream -y; |
| 68 | + flatpak install -y --user flathub org.freedesktop.Sdk//24.08; |
| 69 | + flatpak install -y --user flathub org.freedesktop.Platform//24.08; |
| 70 | + sudo apt-get install -y flatpak flatpak-builder elfutils ; |
| 71 | + git config --global --add protocol.file.allow always |
| 72 | + #sudo snap install snapcraft --classic; |
| 73 | + #sudo snap install core22 --classic; |
| 74 | + fi |
| 75 | + if [[ "${{ matrix.os }}" == "macos-latest" || "${{ matrix.os }}" == "macos-13" ]]; then |
| 76 | + brew install python-setuptools; |
| 77 | + fi |
| 78 | + if [ "${{ matrix.os }}" == "windows-latest" ]; then |
| 79 | + dotnet tool install -g vpk; |
| 80 | + # choco install -y nsis; |
| 81 | + # choco install wixtoolset --version=3.14.0; |
| 82 | + fi |
| 83 | +
|
| 84 | + - name: Setup macOS keychain and signing certificates |
| 85 | + shell: bash |
| 86 | + if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' |
| 87 | + run: | |
| 88 | + # Create temporary keychain |
| 89 | + security create-keychain -p "$APPLE_KEYCHAIN_PASS" "$APPLE_KEYCHAIN_PATH" |
| 90 | + security set-keychain-settings -lut 3600 "$APPLE_KEYCHAIN_PATH" |
| 91 | + security unlock-keychain -p "$APPLE_KEYCHAIN_PASS" "$APPLE_KEYCHAIN_PATH" |
| 92 | + security default-keychain -s "$APPLE_KEYCHAIN_PATH" |
| 93 | +
|
| 94 | + # Import signing certificate (using one p12 for both app and installer) |
| 95 | + echo -n "$APPLE_MAC_CERT" | base64 --decode -o "$CERTIFICATE_PATH" |
| 96 | + security import "$CERTIFICATE_PATH" -P "$APPLE_SIGN_CERT_PASS" -T /usr/bin/codesign -T /usr/bin/productbuild -T /usr/sbin/installer -k "$APPLE_KEYCHAIN_PATH" |
| 97 | + security set-key-partition-list -S apple-tool:,apple:,codesign:,installer: -s -k "$APPLE_KEYCHAIN_PASS" "$APPLE_KEYCHAIN_PATH" |
| 98 | + rm $CERTIFICATE_PATH |
23 | 99 |
|
24 | | - # not needed currently, but leaving here for future use |
25 | | - # - uses: actions/setup-python@v4 |
26 | | - # with: |
27 | | - # python-version: '2.7.18' |
| 100 | + # Import API key for notarization |
| 101 | + echo -n "${{ secrets.APPLE_API_KEY }}" | base64 --decode -o "$NOTARIZATION_KEY_PATH" |
28 | 102 |
|
29 | | - - name: boost |
30 | | - if: startsWith(matrix.os,'ubuntu') |
31 | | - run: sudo apt-get update && sudo apt-get install -yq libboost-dev |
| 103 | + # Create _assets directory if it doesn't exist and generate provisioning profile |
| 104 | + mkdir -p _assets |
| 105 | + if [[ "${{ matrix.target }}" == "mas" ]]; then |
| 106 | + echo -n "${{ secrets.APPLE_PROVISIONING_PROFILE }}" | base64 --decode -o "_assets/embedded.provisionprofile" |
| 107 | + fi |
| 108 | + security find-identity "$APPLE_KEYCHAIN_PATH" -v > /dev/null || true |
| 109 | + security find-identity -p codesigning "$APPLE_KEYCHAIN_PATH" -v > /dev/null || true |
| 110 | + security find-identity -p installer "$APPLE_KEYCHAIN_PATH" -v > /dev/null || true |
| 111 | + env: |
| 112 | + NOTARIZATION_KEY_PATH: "${{ runner.temp }}/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8" |
| 113 | + CERTIFICATE_PATH: "${{ runner.temp }}/signing_cert.p12" |
| 114 | + APPLE_MAC_CERT: ${{ secrets.APPLE_MAC_CERT }} |
| 115 | + APPLE_SIGN_CERT_PASS: ${{ secrets.APPLE_MAC_CERT_PASS }} |
| 116 | + APPLE_KEYCHAIN: ${{ secrets.APPLE_KEYCHAIN }} |
| 117 | + APPLE_KEYCHAIN_PATH: "${{ runner.temp }}/${{ secrets.APPLE_KEYCHAIN }}.keychain-db" |
| 118 | + APPLE_KEYCHAIN_PASS: ${{ secrets.APPLE_KEYCHAIN_PASS }} |
| 119 | + APPLE_NOTARY_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} |
32 | 120 |
|
33 | | - - name: Use Node.js ${{ matrix.node-version }} |
| 121 | + - name: Replace AppIdentifierPrefix in plist files |
| 122 | + shell: bash |
| 123 | + if: matrix.os == 'macos-latest' || matrix.os == 'macos-13' |
| 124 | + run: | |
| 125 | + # Find all entitlements plist files and replace the placeholder |
| 126 | + find _assets -name "entitlements*.plist" -exec sed -i '' "s/\$(AppIdentifierPrefix)/${{secrets.APPLE_TEAM_PREFIX}}/g" {} \; |
| 127 | +
|
| 128 | + - name: Setup Node (v22) |
34 | 129 | uses: actions/setup-node@v4 |
35 | 130 | with: |
36 | | - node-version: ${{ matrix.node-version }} |
| 131 | + # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data |
| 132 | + cache: "npm" |
| 133 | + node-version: "22" |
| 134 | + cache-dependency-path: '**/package-lock.json' |
37 | 135 |
|
38 | | - - name: Build |
| 136 | + - name: Install dependencies |
| 137 | + shell: bash |
39 | 138 | run: | |
40 | | - npm install |
41 | | - npm run build |
42 | | - - name: Package |
43 | | - run: | |
44 | | - npm run dist |
| 139 | + npm install -g npm@latest |
| 140 | + npm ci |
| 141 | + if [[ "${{ matrix.os }}" == "macos-13" || "${{ matrix.os }}" == "macos-latest" ]]; then |
| 142 | + # Install appdmg for macOS builds |
| 143 | + npm install -D appdmg |
| 144 | + fi |
| 145 | +
|
| 146 | + - name: Build (${{ matrix.arch }}) |
| 147 | + uses: DeineAgenturUG/retry@6278ba3ea01ddc52e75d82766fca6cf4d35835cd |
| 148 | + with: |
| 149 | + timeout_minutes: 60 |
| 150 | + max_attempts: 3 |
| 151 | + retry_wait_seconds: 120 |
| 152 | + command: | |
| 153 | + mkdir -p out/make/ |
| 154 | + if [[ "${{ matrix.target }}" == "mas" && ("${{ matrix.os }}" == "macos-13" || "${{ matrix.os }}" == "macos-latest") ]]; then |
| 155 | + npm run make -- --arch ${{ matrix.arch }} || find ./out -type f |
| 156 | + if [[ "${{ matrix.os }}" == "macos-latest" ]]; then |
| 157 | + # For macOS 13, we need to use the universal build for the MAS |
| 158 | + # because it doesn't support arm64 builds. |
| 159 | + npm run make -- --arch universal --platform mas || find ./out -type f |
| 160 | + fi |
| 161 | + else |
| 162 | + npm run make -- --arch ${{ matrix.arch }} |
| 163 | + fi |
| 164 | + find ./out -type f |
| 165 | + shell: bash |
| 166 | + env: |
| 167 | + NOTARIZATION_KEY_PATH: "${{ runner.temp }}/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8" |
| 168 | + APPLE_NOTARY_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} |
| 169 | + APPLE_KEYCHAIN_PATH: "${{ runner.temp }}/${{ secrets.APPLE_KEYCHAIN }}.keychain-db" |
| 170 | + APPLE_DEVELOPER_ID_APPLICATION: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION }} |
| 171 | + APPLE_DEVELOPER_ID_INSTALLER: ${{ secrets.APPLE_DEVELOPER_ID_INSTALLER }} |
| 172 | + APPLE_MAS_IDENTITY: ${{ secrets.APPLE_MAS_IDENTITY }} |
| 173 | + APPLE_MAS_INSTALLER_IDENTITY: ${{ secrets.APPLE_MAS_INSTALLER_IDENTITY }} |
| 174 | + APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} |
| 175 | + APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} |
| 176 | + CI: "true" |
| 177 | + BUILD_NUMBER: ${{ github.run_number }} |
| 178 | + MAKER_ARCH: ${{ matrix.arch }} |
| 179 | + MAKER_PLATFORM: ${{ matrix.target == 'mas' && 'mas' || '' }} |
| 180 | + |
| 181 | + # TODO: add AppImage for linux if we can get snap and/or flatpak to work |
| 182 | + |
| 183 | + - name: Upload artifacts (${{ matrix.arch }}) |
| 184 | + uses: actions/upload-artifact@v4 |
| 185 | + #if: ${{ ((matrix.os == 'ubuntu-24.04' && matrix.arch == 'x64') || (matrix.os == 'ubuntu-24.04-arm' && matrix.arch == 'arm64') || (matrix.os == 'windows' && (matrix.arch == 'x64' || matrix.arch == 'arm64')) || (matrix.os == 'macos_x64' && matrix.arch == 'x64') || (matrix.os == 'macos' && matrix.arch == 'arm64')) }} |
| 186 | + with: |
| 187 | + name: dist-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.target == 'mas' && '-mas' || '' }} |
| 188 | + retention-days: 1 |
| 189 | + path: | |
| 190 | + out/make/ |
0 commit comments