Skip to content

Commit 93908c9

Browse files
committed
On branch edburns/dd-2785864-pre-public-non-code-changes
new file: .github/workflows/publish-snapshot.yml - New workflow, to publish `-SNAPSHOT` build. modified: .vscode/settings.json - Always reload. modified: README.md - Document `-SNAPSHOT` build. modified: pom.xml - Use correct `artifactId`. - Add `<distributionManagement />` section.
1 parent 2f10ab3 commit 93908c9

File tree

4 files changed

+98
-2
lines changed

4 files changed

+98
-2
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish Snapshot to GitHub Packages
2+
3+
env:
4+
HUSKY: 0
5+
6+
on:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
packages: write
12+
13+
concurrency:
14+
group: publish-snapshot
15+
cancel-in-progress: false
16+
17+
jobs:
18+
publish-snapshot:
19+
name: Publish SNAPSHOT to GitHub Packages
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v6
23+
with:
24+
fetch-depth: 0
25+
26+
- uses: ./.github/actions/setup-copilot
27+
28+
- name: Set up JDK 17
29+
uses: actions/setup-java@v5
30+
with:
31+
java-version: "17"
32+
distribution: "temurin"
33+
cache: "maven"
34+
server-id: github
35+
server-username: PACKAGES_USERNAME
36+
server-password: PACKAGES_TOKEN
37+
38+
- name: Verify version is a SNAPSHOT
39+
run: |
40+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
41+
echo "Publishing version: $VERSION"
42+
if [[ "$VERSION" != *"-SNAPSHOT" ]]; then
43+
echo "ERROR: This workflow only publishes SNAPSHOT versions. Current version: $VERSION"
44+
exit 1
45+
fi
46+
echo "### Snapshot Publish" >> $GITHUB_STEP_SUMMARY
47+
echo "- **Version:** $VERSION" >> $GITHUB_STEP_SUMMARY
48+
echo "- **Repository:** GitHub Packages (github/copilot-sdk-java)" >> $GITHUB_STEP_SUMMARY
49+
50+
- name: Deploy Snapshot
51+
run: mvn -B deploy -DskipTests
52+
env:
53+
PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
PACKAGES_USERNAME: ${{ github.actor }}

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"-Dcopilot.tests.dir=${workspaceFolder}/target/copilot-sdk/test"
77
]
88
},
9-
"java.compile.nullAnalysis.mode": "automatic"
9+
"java.compile.nullAnalysis.mode": "automatic",
10+
"java.configuration.updateBuildConfiguration": "automatic"
1011
}

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,40 @@ Java SDK for programmatic control of GitHub Copilot CLI, enabling you to build A
3737
</dependency>
3838
```
3939

40+
#### Snapshot Builds
41+
42+
Snapshot builds of the next development version are published to GitHub Packages. To use them, add the repository and update the dependency version in your `pom.xml`:
43+
44+
```xml
45+
<repositories>
46+
<repository>
47+
<id>github</id>
48+
<url>https://maven.pkg.github.com/github/copilot-sdk-java</url>
49+
<snapshots><enabled>true</enabled></snapshots>
50+
</repository>
51+
</repositories>
52+
53+
<dependency>
54+
<groupId>com.github</groupId>
55+
<artifactId>copilot-sdk</artifactId>
56+
<version>0.1.30-SNAPSHOT</version>
57+
</dependency>
58+
```
59+
60+
GitHub Packages requires authentication even for public packages. Add your credentials to `~/.m2/settings.xml`:
61+
62+
```xml
63+
<settings>
64+
<servers>
65+
<server>
66+
<id>github</id>
67+
<username>YOUR_GITHUB_USERNAME</username>
68+
<password>YOUR_GITHUB_TOKEN</password><!-- needs read:packages scope -->
69+
</server>
70+
</servers>
71+
</settings>
72+
```
73+
4074
### Gradle
4175

4276
```groovy

pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77

88
<groupId>com.github</groupId>
9-
<artifactId>copilot-sdk</artifactId>
9+
<artifactId>copilot-sdk-java</artifactId>
1010
<version>0.1.30-SNAPSHOT</version>
1111
<packaging>jar</packaging>
1212

@@ -36,6 +36,13 @@
3636
<tag>HEAD</tag>
3737
</scm>
3838

39+
<distributionManagement>
40+
<snapshotRepository>
41+
<id>github</id>
42+
<url>https://maven.pkg.github.com/github/copilot-sdk-java</url>
43+
</snapshotRepository>
44+
</distributionManagement>
45+
3946
<properties>
4047
<maven.compiler.release>17</maven.compiler.release>
4148
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

0 commit comments

Comments
 (0)