|
| 1 | +name: Build Dodo Recorder |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + platforms: |
| 9 | + description: 'Platforms to build (comma-separated: macos-arm64,macos-x64,windows,linux)' |
| 10 | + required: false |
| 11 | + default: 'macos-arm64,macos-x64,windows,linux' |
| 12 | + type: choice |
| 13 | + options: |
| 14 | + - 'macos-arm64,macos-x64,windows,linux' |
| 15 | + - 'macos-arm64,windows' |
| 16 | + - 'macos-x64,windows' |
| 17 | + - 'windows,linux' |
| 18 | + - 'macos-arm64,macos-x64' |
| 19 | + - 'windows' |
| 20 | + - 'linux' |
| 21 | + - 'macos-arm64' |
| 22 | + - 'macos-x64' |
| 23 | + |
| 24 | +jobs: |
| 25 | + build: |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + os: [macos-latest, windows-latest, ubuntu-latest] |
| 29 | + include: |
| 30 | + - os: macos-latest |
| 31 | + target: mac |
| 32 | + arch: arm64 |
| 33 | + platform_key: macos-arm64 |
| 34 | + - os: macos-latest |
| 35 | + target: mac |
| 36 | + arch: x64 |
| 37 | + platform_key: macos-x64 |
| 38 | + - os: windows-latest |
| 39 | + target: win |
| 40 | + arch: x64 |
| 41 | + platform_key: windows |
| 42 | + - os: ubuntu-latest |
| 43 | + target: linux |
| 44 | + arch: x64 |
| 45 | + platform_key: linux |
| 46 | + fail-fast: false |
| 47 | + |
| 48 | + runs-on: ${{ matrix.os }} |
| 49 | + if: | |
| 50 | + github.event_name == 'release' || |
| 51 | + contains(github.event.inputs.platforms, matrix.platform_key) |
| 52 | +
|
| 53 | + steps: |
| 54 | + - name: Checkout code |
| 55 | + uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Setup Node.js |
| 58 | + uses: actions/setup-node@v4 |
| 59 | + with: |
| 60 | + node-version: '18' |
| 61 | + |
| 62 | + - name: Get npm cache directory |
| 63 | + id: npm-cache-dir |
| 64 | + shell: bash |
| 65 | + run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT |
| 66 | + |
| 67 | + - name: Cache npm dependencies |
| 68 | + uses: actions/cache@v4 |
| 69 | + with: |
| 70 | + path: ${{ steps.npm-cache-dir.outputs.dir }} |
| 71 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 72 | + restore-keys: | |
| 73 | + ${{ runner.os }}-node- |
| 74 | +
|
| 75 | + - name: Cache Playwright browsers |
| 76 | + uses: actions/cache@v4 |
| 77 | + with: |
| 78 | + path: playwright-browsers |
| 79 | + key: playwright-browsers-${{ runner.os }}-${{ hashFiles('package-lock.json') }} |
| 80 | + restore-keys: | |
| 81 | + playwright-browsers-${{ runner.os }}- |
| 82 | +
|
| 83 | + - name: Install dependencies |
| 84 | + run: npm ci |
| 85 | + |
| 86 | + - name: Download Whisper model |
| 87 | + shell: bash |
| 88 | + run: | |
| 89 | + mkdir -p models |
| 90 | + curl -L -o models/ggml-small.en.bin https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.en.bin |
| 91 | +
|
| 92 | + - name: Install Playwright browsers |
| 93 | + shell: bash |
| 94 | + run: | |
| 95 | + if [ "${{ runner.os }}" = "Windows" ]; then |
| 96 | + bash ./build/install-playwright-browsers.sh |
| 97 | + else |
| 98 | + ./build/install-playwright-browsers.sh |
| 99 | + fi |
| 100 | +
|
| 101 | + - name: Build (macOS arm64) |
| 102 | + if: matrix.os == 'macos-latest' && matrix.arch == 'arm64' |
| 103 | + run: npm run build |
| 104 | + env: |
| 105 | + CSC_LINK: ${{ secrets.MACOS_CERTIFICATE }} |
| 106 | + CSC_KEY_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} |
| 107 | + APPLE_ID: ${{ secrets.APPLE_ID }} |
| 108 | + APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} |
| 109 | + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} |
| 110 | + |
| 111 | + - name: Build (macOS x64) |
| 112 | + if: matrix.os == 'macos-latest' && matrix.arch == 'x64' |
| 113 | + run: npm run build |
| 114 | + env: |
| 115 | + CSC_LINK: ${{ secrets.MACOS_CERTIFICATE }} |
| 116 | + CSC_KEY_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} |
| 117 | + APPLE_ID: ${{ secrets.APPLE_ID }} |
| 118 | + APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} |
| 119 | + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} |
| 120 | + TARGET_ARCH: x64 |
| 121 | + |
| 122 | + - name: Build (Windows) |
| 123 | + if: matrix.os == 'windows-latest' |
| 124 | + run: npm run build |
| 125 | + shell: bash |
| 126 | + |
| 127 | + - name: Build (Linux) |
| 128 | + if: matrix.os == 'ubuntu-latest' |
| 129 | + run: npm run build |
| 130 | + |
| 131 | + - name: Upload artifacts (macOS arm64) |
| 132 | + if: matrix.os == 'macos-latest' && matrix.arch == 'arm64' |
| 133 | + uses: actions/upload-artifact@v4 |
| 134 | + with: |
| 135 | + name: dodo-recorder-macos-arm64 |
| 136 | + path: | |
| 137 | + release/*.dmg |
| 138 | + release/*.zip |
| 139 | + retention-days: 30 |
| 140 | + |
| 141 | + - name: Upload artifacts (macOS x64) |
| 142 | + if: matrix.os == 'macos-latest' && matrix.arch == 'x64' |
| 143 | + uses: actions/upload-artifact@v4 |
| 144 | + with: |
| 145 | + name: dodo-recorder-macos-x64 |
| 146 | + path: | |
| 147 | + release/*.dmg |
| 148 | + release/*.zip |
| 149 | + retention-days: 30 |
| 150 | + |
| 151 | + - name: Upload artifacts (Windows) |
| 152 | + if: matrix.os == 'windows-latest' |
| 153 | + uses: actions/upload-artifact@v4 |
| 154 | + with: |
| 155 | + name: dodo-recorder-windows |
| 156 | + path: release/*.exe |
| 157 | + retention-days: 30 |
| 158 | + |
| 159 | + - name: Upload artifacts (Linux) |
| 160 | + if: matrix.os == 'ubuntu-latest' |
| 161 | + uses: actions/upload-artifact@v4 |
| 162 | + with: |
| 163 | + name: dodo-recorder-linux |
| 164 | + path: | |
| 165 | + release/*.AppImage |
| 166 | + release/*.deb |
| 167 | + retention-days: 30 |
| 168 | + |
| 169 | + release: |
| 170 | + needs: build |
| 171 | + runs-on: ubuntu-latest |
| 172 | + if: github.event_name == 'release' |
| 173 | + permissions: |
| 174 | + contents: write |
| 175 | + |
| 176 | + steps: |
| 177 | + - name: Checkout code |
| 178 | + uses: actions/checkout@v4 |
| 179 | + |
| 180 | + - name: Download all artifacts |
| 181 | + uses: actions/download-artifact@v4 |
| 182 | + with: |
| 183 | + path: artifacts |
| 184 | + |
| 185 | + - name: Display structure of downloaded files |
| 186 | + run: ls -R artifacts |
| 187 | + |
| 188 | + - name: Upload to GitHub Release |
| 189 | + uses: softprops/action-gh-release@v1 |
| 190 | + with: |
| 191 | + files: | |
| 192 | + artifacts/dodo-recorder-macos-arm64/* |
| 193 | + artifacts/dodo-recorder-macos-x64/* |
| 194 | + artifacts/dodo-recorder-windows/* |
| 195 | + artifacts/dodo-recorder-linux/* |
| 196 | + env: |
| 197 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments