Skip to content

Commit 088fc1c

Browse files
authored
Initial commit
0 parents  commit 088fc1c

File tree

182 files changed

+31489
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+31489
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "Python 3",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/python:2-3.14-trixie",
7+
"features": {
8+
"ghcr.io/devcontainers/features/copilot-cli:1": {},
9+
"ghcr.io/devcontainers/features/github-cli:1": {},
10+
"ghcr.io/devcontainers/features/go:1": {},
11+
"ghcr.io/devcontainers/features/node:1": {},
12+
"ghcr.io/devcontainers-extra/features/uv:1": {},
13+
"ghcr.io/schlich/devcontainer-features/just:0": {}
14+
}
15+
16+
// Features to add to the dev container. More info: https://containers.dev/features.
17+
// "features": {},
18+
19+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
20+
// "forwardPorts": [],
21+
22+
// Use 'postCreateCommand' to run commands after the container is created.
23+
// "postCreateCommand": "pip3 install --user -r requirements.txt",
24+
25+
// Configure tool-specific properties.
26+
// "customizations": {},
27+
28+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
29+
// "remoteUser": "root"
30+
}

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @github/copilot-sdk
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Setup Copilot"
2+
description: "Setup Copilot based on the project's package.json file."
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: actions/setup-node@v6
7+
with:
8+
cache: "npm"
9+
cache-dependency-path: "./nodejs/package-lock.json"
10+
node-version: 22
11+
- name: Install dependencies
12+
run: npm --prefix "$(pwd)/nodejs" ci --ignore-scripts
13+
shell: bash
14+
- name: Set CLI path
15+
id: cli-path
16+
run: echo "path=$(pwd)/nodejs/node_modules/@github/copilot/index.js" >> $GITHUB_OUTPUT
17+
shell: bash
18+
- name: Verify CLI works
19+
run: node ${{ steps.cli-path.outputs.path }} --version
20+
shell: bash

.github/dependabot.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'github-actions'
4+
directory: '/'
5+
schedule:
6+
interval: 'weekly'
7+
- package-ecosystem: 'devcontainers'
8+
directory: '/'
9+
schedule:
10+
interval: 'weekly'

.github/workflows/publish.yml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
name: Publish SDK packages
2+
3+
env:
4+
HUSKY: 0
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
dist-tag:
10+
description: "Tag to publish under"
11+
type: choice
12+
required: true
13+
default: "latest"
14+
options:
15+
- latest
16+
- prerelease
17+
version:
18+
description: "Version override (optional, e.g., 1.0.0). If empty, auto-increments."
19+
type: string
20+
required: false
21+
22+
permissions:
23+
contents: write
24+
id-token: write # Required for OIDC
25+
26+
concurrency:
27+
group: publish
28+
cancel-in-progress: false
29+
30+
jobs:
31+
# Shared job to calculate version once for all publish jobs
32+
version:
33+
name: Calculate Version
34+
runs-on: ubuntu-latest
35+
outputs:
36+
version: ${{ steps.version.outputs.VERSION }}
37+
current: ${{ steps.version.outputs.CURRENT }}
38+
current-prerelease: ${{ steps.version.outputs.CURRENT_PRERELEASE }}
39+
defaults:
40+
run:
41+
working-directory: ./nodejs
42+
steps:
43+
- uses: actions/checkout@v6
44+
- uses: actions/setup-node@v6
45+
with:
46+
node-version: "22.x"
47+
- run: npm ci --ignore-scripts
48+
- name: Get version
49+
id: version
50+
run: |
51+
CURRENT="$(node scripts/get-version.js current)"
52+
echo "CURRENT=$CURRENT" >> $GITHUB_OUTPUT
53+
echo "Current latest version: $CURRENT" >> $GITHUB_STEP_SUMMARY
54+
CURRENT_PRERELEASE="$(node scripts/get-version.js current-prerelease)"
55+
echo "CURRENT_PRERELEASE=$CURRENT_PRERELEASE" >> $GITHUB_OUTPUT
56+
echo "Current prerelease version: $CURRENT_PRERELEASE" >> $GITHUB_STEP_SUMMARY
57+
if [ -n "${{ github.event.inputs.version }}" ]; then
58+
VERSION="${{ github.event.inputs.version }}"
59+
# Validate version format matches dist-tag
60+
if [ "${{ github.event.inputs.dist-tag }}" = "latest" ]; then
61+
if [[ "$VERSION" == *-* ]]; then
62+
echo "❌ Error: Version '$VERSION' has a prerelease suffix but dist-tag is 'latest'" >> $GITHUB_STEP_SUMMARY
63+
echo "Use a version without suffix (e.g., '1.0.0') for latest releases"
64+
exit 1
65+
fi
66+
else
67+
if [[ "$VERSION" != *-* ]]; then
68+
echo "❌ Error: Version '$VERSION' has no prerelease suffix but dist-tag is 'prerelease'" >> $GITHUB_STEP_SUMMARY
69+
echo "Use a version with suffix (e.g., '1.0.0-preview.0') for prerelease"
70+
exit 1
71+
fi
72+
fi
73+
echo "Using manual version override: $VERSION" >> $GITHUB_STEP_SUMMARY
74+
else
75+
VERSION="$(node scripts/get-version.js ${{ github.event.inputs.dist-tag }})"
76+
echo "Auto-incremented version: $VERSION" >> $GITHUB_STEP_SUMMARY
77+
fi
78+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
79+
80+
publish-nodejs:
81+
name: Publish Node.js SDK
82+
needs: version
83+
runs-on: ubuntu-latest
84+
defaults:
85+
run:
86+
working-directory: ./nodejs
87+
steps:
88+
- uses: actions/checkout@v6
89+
- uses: actions/setup-node@v6
90+
with:
91+
node-version: "22.x"
92+
- name: Update npm for OIDC support
93+
run: npm i -g "[email protected]"
94+
- run: npm ci --ignore-scripts
95+
- name: Set version
96+
run: node scripts/set-version.js
97+
env:
98+
VERSION: ${{ needs.version.outputs.version }}
99+
- name: Temporarily replace README.md
100+
run: echo "Coming soon" > README.md
101+
- name: Build
102+
run: npm run build
103+
- name: Pack
104+
run: npm pack
105+
- name: Upload artifact
106+
uses: actions/upload-artifact@v6
107+
with:
108+
name: nodejs-package
109+
path: nodejs/*.tgz
110+
# TODO: Re-enable npm publish once ready
111+
# - name: Publish to npm
112+
# run: npm publish --tag ${{ github.event.inputs.dist-tag }} --access public --registry https://registry.npmjs.org
113+
114+
publish-dotnet:
115+
name: Publish .NET SDK
116+
needs: version
117+
runs-on: ubuntu-latest
118+
defaults:
119+
run:
120+
working-directory: ./dotnet
121+
steps:
122+
- uses: actions/checkout@v6
123+
- uses: actions/setup-dotnet@v5
124+
with:
125+
dotnet-version: "8.0.x"
126+
- name: Restore dependencies
127+
run: dotnet restore
128+
- name: Build and pack
129+
run: dotnet pack src/GitHub.Copilot.SDK.csproj -c Release -p:Version=${{ needs.version.outputs.version }} -o ./artifacts
130+
- name: Upload artifact
131+
uses: actions/upload-artifact@v6
132+
with:
133+
name: dotnet-package
134+
path: dotnet/artifacts/*.nupkg
135+
- name: NuGet login (OIDC)
136+
uses: NuGet/login@v1
137+
id: nuget-login
138+
with:
139+
# The following must be a username, not an organization name, and that user must have configured Trusted Publishing
140+
# for this owner/repo/workflow combination in their NuGet.org account settings. We could set up a dedicated user for
141+
# this purpose if needed, but then we'd have to manage that account separately. Other GitHub-owned packages on NuGet
142+
# are associated with individual maintainers' accounts too.
143+
user: stevesanderson
144+
- name: Publish to NuGet
145+
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
146+
147+
publish-python:
148+
name: Publish Python SDK
149+
needs: version
150+
runs-on: ubuntu-latest
151+
defaults:
152+
run:
153+
working-directory: ./python
154+
steps:
155+
- uses: actions/checkout@v6
156+
- uses: actions/setup-python@v6
157+
with:
158+
python-version: "3.12"
159+
- name: Set up uv
160+
uses: astral-sh/setup-uv@v7
161+
- name: Set version
162+
run: sed -i "s/^version = .*/version = \"${{ needs.version.outputs.version }}\"/" pyproject.toml
163+
- name: Build package
164+
run: uv build
165+
- name: Upload artifact
166+
uses: actions/upload-artifact@v6
167+
with:
168+
name: python-package
169+
path: python/dist/*
170+
- name: Publish to PyPI
171+
uses: pypa/gh-action-pypi-publish@release/v1
172+
with:
173+
packages-dir: python/dist/
174+
175+
github-release:
176+
name: Create GitHub Release
177+
needs: [version, publish-nodejs, publish-dotnet, publish-python]
178+
if: github.ref == 'refs/heads/main'
179+
runs-on: ubuntu-latest
180+
steps:
181+
- uses: actions/checkout@v6
182+
- name: Create GitHub Release
183+
if: github.event.inputs.dist-tag == 'latest'
184+
run: |
185+
NOTES_FLAG=""
186+
if git rev-parse "v${{ needs.version.outputs.current }}" >/dev/null 2>&1; then
187+
NOTES_FLAG="--notes-start-tag v${{ needs.version.outputs.current }}"
188+
fi
189+
gh release create "v${{ needs.version.outputs.version }}" \
190+
--title "v${{ needs.version.outputs.version }}" \
191+
--generate-notes $NOTES_FLAG \
192+
--target ${{ github.sha }}
193+
env:
194+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195+
- name: Create GitHub Pre-Release
196+
if: github.event.inputs.dist-tag == 'prerelease'
197+
run: |
198+
NOTES_FLAG=""
199+
if git rev-parse "v${{ needs.version.outputs.current-prerelease }}" >/dev/null 2>&1; then
200+
NOTES_FLAG="--notes-start-tag v${{ needs.version.outputs.current-prerelease }}"
201+
fi
202+
gh release create "v${{ needs.version.outputs.version }}" \
203+
--prerelease \
204+
--title "v${{ needs.version.outputs.version }}" \
205+
--generate-notes $NOTES_FLAG \
206+
--target ${{ github.sha }}
207+
env:
208+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)