Build #94
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-mac: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install desktop dependencies | |
| run: cd apps/desktop && npm ci | |
| - name: Build desktop | |
| run: cd apps/desktop && npm run build | |
| - name: Import certificates | |
| env: | |
| MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }} | |
| MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }} | |
| run: | | |
| echo -n "$MAC_CERTIFICATE" | base64 --decode > certificate.p12 | |
| security create-keychain -p "$MAC_CERTIFICATE_PASSWORD" build.keychain | |
| security default-keychain -s build.keychain | |
| security unlock-keychain -p "$MAC_CERTIFICATE_PASSWORD" build.keychain | |
| security import certificate.p12 -k build.keychain -P "$MAC_CERTIFICATE_PASSWORD" -T /usr/bin/codesign | |
| security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MAC_CERTIFICATE_PASSWORD" build.keychain | |
| rm certificate.p12 | |
| - name: Build Electron app for Mac | |
| run: cd apps/desktop && npx electron-builder --mac --publish never | |
| env: | |
| CSC_LINK: ${{ secrets.MAC_CERTIFICATE }} | |
| CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }} | |
| CSC_NAME: "TeamSpark LLC (YB487TSKXW)" | |
| APPLE_ID: ${{ vars.APPLE_ID }} | |
| APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
| APPLE_TEAM_ID: ${{ vars.APPLE_TEAM_ID }} | |
| - name: Upload Mac artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mac-build | |
| path: | | |
| apps/desktop/release/*.dmg | |
| apps/desktop/release/*.zip | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install agent-api dependencies | |
| run: cd packages/agent-api && npm ci | |
| - name: Install desktop dependencies | |
| run: cd apps/desktop && npm ci | |
| - name: Build desktop | |
| run: cd apps/desktop && npm run build | |
| - name: Build Electron app for Linux | |
| run: cd apps/desktop && npx electron-builder --linux --publish never | |
| - name: Upload Linux artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-build | |
| path: | | |
| apps/desktop/release/*.AppImage | |
| apps/desktop/release/*.deb | |
| upload-artifacts: | |
| needs: [build-mac, build-linux] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Mac artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mac-build | |
| path: release | |
| - name: Download Linux artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-build | |
| path: release | |
| - name: Create current versions | |
| run: | | |
| # Create current versions of all files | |
| for f in release/*; do | |
| if [[ $f =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then | |
| # Create a copy with 'latest' instead of version number | |
| new_name=$(echo $f | sed 's/[0-9]\+\.[0-9]\+\.[0-9]\+/latest/') | |
| cp "$f" "$new_name" | |
| fi | |
| done | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.GCS_CREDENTIALS }} | |
| - name: Upload /release files | |
| uses: google-github-actions/upload-cloud-storage@v2 | |
| with: | |
| path: release | |
| destination: tsagent | |
| parent: false |