microsoft/TypeAgent
Publicmirrored fromhttps://github.com/microsoft/TypeAgentAvailable
.github/workflows/build-package-shell.yml
102lines · modecode
| 1 | # Copyright (c) Microsoft Corporation. |
| 2 | # Licensed under the MIT License. |
| 3 | |
| 4 | # This workflow will build and package the TypeAgent TypeScript code |
| 5 | |
| 6 | name: build-package-shell |
| 7 | |
| 8 | on: |
| 9 | workflow_dispatch: |
| 10 | push: |
| 11 | branches: ["main"] |
| 12 | pull_request: |
| 13 | branches: ["main"] |
| 14 | merge_group: |
| 15 | branches: ["main"] |
| 16 | |
| 17 | concurrency: |
| 18 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 19 | cancel-in-progress: true |
| 20 | |
| 21 | permissions: |
| 22 | pull-requests: read |
| 23 | contents: read |
| 24 | |
| 25 | env: |
| 26 | ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron |
| 27 | ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder |
| 28 | |
| 29 | jobs: |
| 30 | build_package_shell: |
| 31 | strategy: |
| 32 | fail-fast: false |
| 33 | matrix: |
| 34 | os: ["ubuntu-latest", "windows-latest", "macos-latest"] |
| 35 | version: [22] |
| 36 | |
| 37 | runs-on: ${{ matrix.os }} |
| 38 | |
| 39 | steps: |
| 40 | - name: Setup Git LF |
| 41 | run: | |
| 42 | git config --global core.autocrlf false |
| 43 | - uses: actions/checkout@v4 |
| 44 | - uses: dorny/paths-filter@v3 |
| 45 | id: filter |
| 46 | continue-on-error: true |
| 47 | with: |
| 48 | filters: | |
| 49 | ts: |
| 50 | - "ts/**" |
| 51 | - ".github/workflows/build-package-shell.yml" |
| 52 | - uses: pnpm/action-setup@v4 |
| 53 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 54 | name: Install pnpm |
| 55 | with: |
| 56 | package_json_file: ts/package.json |
| 57 | - uses: actions/setup-node@v4 |
| 58 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 59 | with: |
| 60 | node-version: ${{ matrix.version }} |
| 61 | cache: "pnpm" |
| 62 | cache-dependency-path: ts/pnpm-lock.yaml |
| 63 | - name: Install dependencies |
| 64 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 65 | working-directory: ts |
| 66 | run: | |
| 67 | pnpm install --frozen-lockfile --strict-peer-dependencies |
| 68 | - name: Build |
| 69 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 70 | working-directory: ts |
| 71 | run: | |
| 72 | pnpm run build:shell |
| 73 | env: |
| 74 | DEBUG_DEMB: true |
| 75 | # Reusing the cache can be flaky. If a downloaded archive is corrupted it can cause |
| 76 | # problems because github tries to reuse the same machine for the next job leading to |
| 77 | # blocked builds. This is a bug in electron-builder, it's not smart enough to retry acquiring the archive. |
| 78 | # Disabling for now. |
| 79 | # - name: Electron Builder Cache |
| 80 | # if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 81 | # uses: actions/cache@v4 |
| 82 | # with: |
| 83 | # key: electron | ${{ runner.os }} | ${{ runner.arch }} | ${{ hashFiles('**/pnpm-lock.yaml') }} |
| 84 | # path: | |
| 85 | # ${{ env.ELECTRON_BUILDER_CACHE }} |
| 86 | # ${{ env.ELECTRON_CACHE }} |
| 87 | # restore-keys: | |
| 88 | # electron | ${{ runner.os }} | ${{ runner.arch }} |
| 89 | - name: Package - shell |
| 90 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 91 | working-directory: ts |
| 92 | shell: bash |
| 93 | run: pnpm run shell:package |
| 94 | |
| 95 | # - uses: actions/upload-artifact@v4 |
| 96 | # if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 97 | # name: Upload build artifact |
| 98 | # with: |
| 99 | # name: typeagent-shell-${{ matrix.os }}-${{ github.run_number }} |
| 100 | # path: ts/packages/shell/dist/** # files/dirs to include |
| 101 | # retention-days: 7 |
| 102 | |
| 103 | |