Skip to content

Commit f09157d

Browse files
committed
Merge branch 'main' into cursor/SOU-193-mcp-undefined-filename-bug-9338
2 parents e236c22 + a14f0c2 commit f09157d

17 files changed

Lines changed: 565 additions & 270 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
1-
name: Publish to ghcr
2-
3-
# This workflow is a modification of a example.
1+
# Internal reusable workflow for building multi-platform Docker images.
2+
#
3+
# This workflow builds Docker images for linux/amd64 and linux/arm64 platforms,
4+
# pushes them by digest to GHCR, signs them with cosign/Sigstore for supply chain
5+
# security, and uploads build artifacts for subsequent manifest creation.
6+
#
47
# @ see: https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
58

9+
name: Build Multi-Platform Images
10+
611
on:
7-
push:
8-
branches: ["main"]
9-
tags: ["v*.*.*"]
10-
workflow_dispatch:
11-
inputs:
12-
version:
13-
description: 'Version tag (e.g., v4.10.5)'
14-
required: false
15-
type: string
1612
workflow_call:
1713
inputs:
18-
version:
19-
description: 'Version tag (e.g., v4.10.5)'
20-
required: false
14+
git_ref:
15+
description: "Git ref to checkout"
16+
required: true
2117
type: string
18+
docker_tags:
19+
description: "Docker tags configuration (JSON array or raw tags)"
20+
required: true
21+
type: string
22+
use_app_token:
23+
description: "Whether to use GitHub App token for checkout"
24+
required: false
25+
type: boolean
26+
default: false
27+
secrets:
28+
release_app_id:
29+
description: "GitHub App ID (required if use_app_token is true)"
30+
required: false
31+
release_app_private_key:
32+
description: "GitHub App private key (required if use_app_token is true)"
33+
required: false
2234

2335
env:
24-
# Use docker.io for Docker Hub if empty
2536
REGISTRY_IMAGE: ghcr.io/sourcebot-dev/sourcebot
2637

2738
jobs:
@@ -31,8 +42,8 @@ jobs:
3142
permissions:
3243
contents: read
3344
packages: write
34-
# This is used to complete the identity challenge
35-
# with sigstore/fulcio when running outside of PRs.
45+
# Required for keyless signing with cosign/Sigstore.
46+
# Allows workflow to obtain OIDC token for ephemeral certificate from Fulcio.
3647
id-token: write
3748
strategy:
3849
matrix:
@@ -44,6 +55,14 @@ jobs:
4455
runs-on: ubuntu-24.04-arm
4556

4657
steps:
58+
- name: Generate GitHub App token
59+
if: inputs.use_app_token
60+
id: generate_token
61+
uses: actions/create-github-app-token@v1
62+
with:
63+
app-id: ${{ secrets.release_app_id }}
64+
private-key: ${{ secrets.release_app_private_key }}
65+
4766
- name: Prepare
4867
run: |
4968
platform=${{ matrix.platform }}
@@ -52,8 +71,10 @@ jobs:
5271
- name: Checkout repository
5372
uses: actions/checkout@v4
5473
with:
55-
ref: ${{ inputs.version || github.ref_name }}
74+
ref: ${{ inputs.git_ref }}
5675
submodules: "true"
76+
fetch-depth: 0
77+
token: ${{ inputs.use_app_token && steps.generate_token.outputs.token || github.token }}
5778

5879
# Extract metadata (tags, labels) for Docker
5980
# https://github.com/docker/metadata-action
@@ -62,6 +83,7 @@ jobs:
6283
uses: docker/metadata-action@v5
6384
with:
6485
images: ${{ env.REGISTRY_IMAGE }}
86+
tags: ${{ inputs.docker_tags }}
6587

6688
# Install the cosign tool except on PR
6789
# https://github.com/sigstore/cosign-installer
@@ -118,43 +140,4 @@ jobs:
118140
# This step uses the identity token to provision an ephemeral certificate
119141
# against the sigstore community Fulcio instance.
120142
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
121-
122-
merge:
123-
runs-on: ubuntu-latest
124-
permissions:
125-
packages: write
126-
needs:
127-
- build
128-
steps:
129-
- name: Download digests
130-
uses: actions/download-artifact@v4
131-
with:
132-
path: /tmp/digests
133-
pattern: digests-*
134-
merge-multiple: true
135-
136-
- name: Set up Docker Buildx
137-
uses: docker/setup-buildx-action@v3
138-
139-
- name: Extract Docker metadata
140-
id: meta
141-
uses: docker/metadata-action@v5
142-
with:
143-
images: ${{ env.REGISTRY_IMAGE }}
144143

145-
- name: Login to GitHub Packages Docker Registry
146-
uses: docker/login-action@v3
147-
with:
148-
registry: ghcr.io
149-
username: ${{ github.actor }}
150-
password: ${{ secrets.GITHUB_TOKEN }}
151-
152-
- name: Create manifest list and push
153-
working-directory: /tmp/digests
154-
run: |
155-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
156-
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
157-
158-
- name: Inspect image
159-
run: |
160-
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

.github/workflows/_merge.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Internal reusable workflow for merging platform-specific image digests into a
2+
# single multi-platform manifest and pushing to GHCR.
3+
#
4+
# This workflow takes the individual platform image digests created by _build.yml,
5+
# combines them into a multi-platform manifest, and pushes the final tagged images.
6+
7+
name: Merge Multi-Platform Manifest
8+
9+
on:
10+
workflow_call:
11+
inputs:
12+
docker_tags:
13+
description: "Docker tags configuration (JSON array or raw tags)"
14+
required: true
15+
type: string
16+
17+
env:
18+
REGISTRY_IMAGE: ghcr.io/sourcebot-dev/sourcebot
19+
20+
jobs:
21+
merge:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
packages: write
25+
steps:
26+
- name: Download digests
27+
uses: actions/download-artifact@v4
28+
with:
29+
path: /tmp/digests
30+
pattern: digests-*
31+
merge-multiple: true
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Extract Docker metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY_IMAGE }}
41+
tags: ${{ inputs.docker_tags }}
42+
43+
- name: Login to GitHub Packages Docker Registry
44+
uses: docker/login-action@v3
45+
with:
46+
registry: ghcr.io
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Create manifest list and push
51+
working-directory: /tmp/digests
52+
run: |
53+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
54+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
55+
56+
- name: Inspect image
57+
run: |
58+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
59+

.github/workflows/release-dev.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release Sourcebot (Development)
2+
3+
permissions:
4+
contents: read
5+
packages: write
6+
id-token: write
7+
8+
on:
9+
push:
10+
branches: ["main"]
11+
12+
jobs:
13+
build:
14+
uses: ./.github/workflows/_build.yml
15+
with:
16+
git_ref: ${{ github.ref_name }}
17+
docker_tags: type=raw,value=main
18+
use_app_token: false
19+
secrets: inherit
20+
21+
publish-to-registry:
22+
needs: build
23+
uses: ./.github/workflows/_merge.yml
24+
with:
25+
docker_tags: type=raw,value=main

0 commit comments

Comments
 (0)