|
| 1 | +name: Rivet Deploy (kitchen-sink) |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened, closed] |
| 6 | + paths: |
| 7 | + - "examples/kitchen-sink/**" |
| 8 | + - "rivetkit-typescript/packages/**" |
| 9 | + - "engine/sdks/typescript/**" |
| 10 | + - "shared/typescript/**" |
| 11 | + - "docker/build/linux-x64-gnu.Dockerfile" |
| 12 | + - ".github/workflows/rivet-deploy-kitchen-sink.yml" |
| 13 | + push: |
| 14 | + branches: [main] |
| 15 | + paths: |
| 16 | + - "examples/kitchen-sink/**" |
| 17 | + - "rivetkit-typescript/packages/**" |
| 18 | + - "engine/sdks/typescript/**" |
| 19 | + - "shared/typescript/**" |
| 20 | + - "docker/build/linux-x64-gnu.Dockerfile" |
| 21 | + - ".github/workflows/rivet-deploy-kitchen-sink.yml" |
| 22 | + workflow_dispatch: |
| 23 | + |
| 24 | +concurrency: |
| 25 | + group: rivet-deploy-kitchen-sink-${{ github.event.pull_request.number || github.ref }} |
| 26 | + cancel-in-progress: true |
| 27 | + |
| 28 | +jobs: |
| 29 | + rivet-deploy: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + pull-requests: write |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + - name: Set up Docker Buildx |
| 37 | + uses: docker/setup-buildx-action@v3 |
| 38 | + - name: Build rivetkit-napi .node (linux-x64-gnu) |
| 39 | + env: |
| 40 | + DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }} |
| 41 | + run: | |
| 42 | + set -euo pipefail |
| 43 | + # The DEPOT_TOKEN enables sccache; the Dockerfile gracefully falls |
| 44 | + # back to a no-cache build if it isn't set. |
| 45 | + DEPOT_TOKEN_FILE=$(mktemp) |
| 46 | + printf "%s" "${DEPOT_TOKEN:-}" > "${DEPOT_TOKEN_FILE}" |
| 47 | + docker buildx build \ |
| 48 | + --file docker/build/linux-x64-gnu.Dockerfile \ |
| 49 | + --build-arg BUILD_TARGET=rivetkit-napi \ |
| 50 | + --build-arg BUILD_MODE=release \ |
| 51 | + --secret id=DEPOT_TOKEN,src="${DEPOT_TOKEN_FILE}" \ |
| 52 | + --load \ |
| 53 | + --tag rivetkit-napi-builder:local \ |
| 54 | + . |
| 55 | + rm -f "${DEPOT_TOKEN_FILE}" |
| 56 | + container_id=$(docker create rivetkit-napi-builder:local) |
| 57 | + docker cp "${container_id}:/artifacts/rivetkit-napi.linux-x64-gnu.node" \ |
| 58 | + ./examples/kitchen-sink/rivetkit-napi.linux-x64-gnu.node |
| 59 | + docker rm "${container_id}" >/dev/null |
| 60 | + ls -lh ./examples/kitchen-sink/rivetkit-napi.linux-x64-gnu.node |
| 61 | + - name: Collect workspace manifest stubs |
| 62 | + run: | |
| 63 | + set -euo pipefail |
| 64 | + # pnpm deploy resolves the full workspace topology even when filtered, |
| 65 | + # so it needs every workspace package.json that isn't already in the |
| 66 | + # Dockerfile's COPY set. Collect them under a single dir that the |
| 67 | + # Dockerfile copies AFTER pnpm install/build (so install isn't |
| 68 | + # tempted to walk them). |
| 69 | + rm -rf .docker-ks-manifests |
| 70 | + mkdir -p .docker-ks-manifests |
| 71 | + find . -type f -name 'package.json' \ |
| 72 | + -not -path './node_modules/*' \ |
| 73 | + -not -path '*/node_modules/*' \ |
| 74 | + -not -path './target/*' \ |
| 75 | + -not -path './.git/*' \ |
| 76 | + -not -path './.docker-ks-manifests/*' \ |
| 77 | + -not -path './napi-artifacts/*' \ |
| 78 | + -not -path './package.json' \ |
| 79 | + -not -path './examples/kitchen-sink/*' \ |
| 80 | + -not -path './rivetkit-typescript/packages/*' \ |
| 81 | + -not -path './engine/sdks/typescript/*' \ |
| 82 | + -not -path './shared/typescript/*' \ |
| 83 | + -print0 | |
| 84 | + while IFS= read -r -d '' src; do |
| 85 | + rel="${src#./}" |
| 86 | + dest=".docker-ks-manifests/${rel}" |
| 87 | + mkdir -p "$(dirname "${dest}")" |
| 88 | + cp "${src}" "${dest}" |
| 89 | + done |
| 90 | + echo "manifest stubs:" |
| 91 | + find .docker-ks-manifests -name package.json | sort |
| 92 | + - uses: rivet-dev/deploy-action@v1.1.0 |
| 93 | + with: |
| 94 | + rivet-token: ${{ secrets.KITCHEN_SINK_RIVET_CLOUD_TOKEN }} |
| 95 | + dockerfile-path: examples/kitchen-sink/Dockerfile |
| 96 | + docker-build-path: . |
| 97 | + managed-pool-config: '{"environment":{"PORT":"8080"}}' |
0 commit comments