The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | name: Package Preview |
| 2 | |
| 3 | # Builds, packs, and publishes preview packages from the job that built them. |
| 4 | # The job proves it is the run it claims to be by uploading the manifest as |
| 5 | # an artifact of its own run, which only the job's runtime token can do; the |
| 6 | # registry reads the artifact list back through the GitHub API. That works |
| 7 | # the same for pushes, same-repo pull requests, and fork pull requests, and |
| 8 | # needs no permissions or secrets. The upload has to be an action step: the |
| 9 | # runtime token is never exposed to `run:` steps. |
| 10 | |
| 11 | on: |
| 12 | push: |
| 13 | branches: [main] |
| 14 | paths: |
| 15 | - "submodules/distilled" |
| 16 | - "packages/**" |
| 17 | - "scripts/**" |
| 18 | - "package.json" |
| 19 | - "pnpm-lock.yaml" |
| 20 | - "pnpm-workspace.yaml" |
| 21 | - "tsconfig.json" |
| 22 | - ".github/workflows/pkg.yml" |
| 23 | pull_request: |
| 24 | types: [opened, synchronize, reopened, labeled] |
| 25 | paths: |
| 26 | - "submodules/distilled" |
| 27 | - "packages/**" |
| 28 | - "scripts/**" |
| 29 | - "package.json" |
| 30 | - "pnpm-lock.yaml" |
| 31 | - "pnpm-workspace.yaml" |
| 32 | - "tsconfig.json" |
| 33 | - ".github/workflows/pkg.yml" |
| 34 | |
| 35 | permissions: |
| 36 | contents: read |
| 37 | |
| 38 | env: |
| 39 | PKG_REGISTRY: https://pkg.alchemy.run |
| 40 | |
| 41 | concurrency: |
| 42 | # Label events get a group per label so adding an unrelated label (such as |
| 43 | # `deploy-website`) never cancels the run for the latest push. |
| 44 | group: pkg-${{ github.event.pull_request.number || github.ref }}${{ github.event.action == 'labeled' && format('-{0}', github.event.label.name) || '' }} |
| 45 | cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 46 | |
| 47 | jobs: |
| 48 | publish: |
| 49 | name: Publish preview packages |
| 50 | # `labeled` is only for `force-ci`, which repacks every package. |
| 51 | if: github.event.action != 'labeled' || github.event.label.name == 'force-ci' |
| 52 | runs-on: blacksmith-8vcpu-ubuntu-2404 |
| 53 | steps: |
| 54 | - name: Checkout repository |
| 55 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 56 | with: |
| 57 | # Pack the pull request head rather than the synthetic merge commit, |
| 58 | # so every tarball is addressed by a commit that exists on the PR. |
| 59 | ref: ${{ github.event.pull_request.head.sha || github.sha }} |
| 60 | fetch-depth: 0 |
| 61 | |
| 62 | - name: Checkout distilled |
| 63 | run: git submodule update --init --depth=1 --checkout -- submodules/distilled |
| 64 | |
| 65 | - name: Setup pnpm, Node.js, Bun and install dependencies |
| 66 | uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0 |
| 67 | with: |
| 68 | cache: true |
| 69 | install: true |
| 70 | require-lockfile: true |
| 71 | |
| 72 | - name: Build packages |
| 73 | run: pnpm build:pkg |
| 74 | |
| 75 | # The build emits plain tsc output for distilled SDKs that had no `lib/` |
| 76 | # when install's `ensure:built` ran (such as iceberg, referenced only by |
| 77 | # @alchemy.run/cloudflare). Bundle them now so their tarballs ship the |
| 78 | # `distilled-lazy` files their exports point at. |
| 79 | - name: Bundle distilled packages |
| 80 | run: pnpm ensure:built |
| 81 | |
| 82 | # Workspace dependencies of the listed packages, such as the |
| 83 | # @distilled.cloud SDKs, are packed automatically under a collapsed |
| 84 | # "Transitive Dependencies" group. Keep the @alchemy.run |
| 85 | # list in sync with `build:pkg`. |
| 86 | - name: Pack packages |
| 87 | id: pack |
| 88 | run: >- |
| 89 | pnpm exec pkg pack |
| 90 | ${{ contains(github.event.pull_request.labels.*.name, 'force-ci') && '--all' || '' }} |
| 91 | --rebuild-all-path 'scripts/package-build.ts' |
| 92 | --group 'alchemy=./packages/alchemy' |
| 93 | --group '@alchemy.run[Collapsed]=./packages/{better-auth,git,drizzle,sqlite,acme,axiom,doppler,infisical,turso,planetscale,neon,prisma,hetzner,railway,fly,github,stripe,cloudflare,gcp,aws,domain,kubernetes,docker,redis,sql,cloudflare-runtime,frontend-frameworks,node-utils,pkg}' |
| 94 | |
| 95 | - name: Vouch for the manifest |
| 96 | if: steps.pack.outputs.package-count != '0' |
| 97 | uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 98 | with: |
| 99 | name: ${{ steps.pack.outputs.artifact-name }} |
| 100 | path: .pkg/pkg-manifest.json |
| 101 | include-hidden-files: true |
| 102 | if-no-files-found: error |
| 103 | retention-days: 1 |
| 104 | |
| 105 | - name: Publish packages |
| 106 | if: steps.pack.outputs.package-count != '0' |
| 107 | run: pnpm exec pkg publish |