|
| 1 | +name: Pipeline Image |
| 2 | + |
| 3 | +# Build (and optionally push) the VCR pipeline appliance used by sandbox deposit/read. |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - version/** |
| 8 | + - main |
| 9 | + paths: |
| 10 | + - 'packages/pipeline-image/**' |
| 11 | + - 'packages/pipeline-hosts/**' |
| 12 | + - 'packages/host-generics/**' |
| 13 | + - 'packages/asset-packs-pipelines/**' |
| 14 | + - 'packages/pipelines-generics/**' |
| 15 | + - 'packages/btd/**' |
| 16 | + - 'pnpm-lock.yaml' |
| 17 | + - '.github/workflows/pipeline-image.yml' |
| 18 | + workflow_dispatch: |
| 19 | + inputs: |
| 20 | + push_to_vcr: |
| 21 | + description: 'Push image to VCR (requires secrets)' |
| 22 | + required: false |
| 23 | + default: 'false' |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 27 | + cancel-in-progress: true |
| 28 | + |
| 29 | +permissions: |
| 30 | + contents: read |
| 31 | + |
| 32 | +jobs: |
| 33 | + materialize-and-build: |
| 34 | + name: Materialize runners + Docker build |
| 35 | + runs-on: ubuntu-latest |
| 36 | + timeout-minutes: 45 |
| 37 | + steps: |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v4 |
| 40 | + |
| 41 | + - name: Setup pnpm |
| 42 | + uses: pnpm/action-setup@v4 |
| 43 | + |
| 44 | + - name: Setup Node |
| 45 | + uses: actions/setup-node@v4 |
| 46 | + with: |
| 47 | + node-version: '24' |
| 48 | + cache: pnpm |
| 49 | + |
| 50 | + - name: Install dependencies |
| 51 | + run: pnpm install --frozen-lockfile |
| 52 | + |
| 53 | + - name: Materialize pipeline-image runners |
| 54 | + run: pnpm --filter @bitcode/pipeline-image run materialize |
| 55 | + |
| 56 | + - name: Pipeline-image unit test |
| 57 | + run: pnpm --filter @bitcode/pipeline-image test |
| 58 | + |
| 59 | + - name: Set up Docker Buildx |
| 60 | + uses: docker/setup-buildx-action@v3 |
| 61 | + |
| 62 | + - name: Build pipeline image (local tag) |
| 63 | + run: | |
| 64 | + docker build \ |
| 65 | + -f packages/pipeline-image/Dockerfile \ |
| 66 | + -t "bitcode-pipeline:ci-${GITHUB_SHA}" \ |
| 67 | + . |
| 68 | +
|
| 69 | + - name: Log in to VCR and push |
| 70 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.push_to_vcr == 'true' }} |
| 71 | + env: |
| 72 | + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} |
| 73 | + VERCEL_TEAM_ID: ${{ secrets.VERCEL_TEAM_ID }} |
| 74 | + VCR_IMAGE: ${{ vars.BITCODE_PIPELINE_VCR_IMAGE }} |
| 75 | + run: | |
| 76 | + if [ -z "$VERCEL_TOKEN" ] || [ -z "$VERCEL_TEAM_ID" ] || [ -z "$VCR_IMAGE" ]; then |
| 77 | + echo "Missing VERCEL_TOKEN, VERCEL_TEAM_ID, or BITCODE_PIPELINE_VCR_IMAGE" >&2 |
| 78 | + exit 1 |
| 79 | + fi |
| 80 | + printf '%s' "$VERCEL_TOKEN" | docker login vcr.vercel.com \ |
| 81 | + --username "$VERCEL_TEAM_ID" \ |
| 82 | + --password-stdin |
| 83 | + SHORT_SHA="$(echo "$GITHUB_SHA" | cut -c1-7)" |
| 84 | + TAG="${VCR_IMAGE}:v48-${SHORT_SHA}" |
| 85 | + docker tag "bitcode-pipeline:ci-${GITHUB_SHA}" "$TAG" |
| 86 | + docker push "$TAG" |
| 87 | + echo "Pushed $TAG" |
| 88 | + echo "Set Production BITCODE_PIPELINE_SANDBOX_IMAGE=$TAG" |
0 commit comments