Skip to content

Commit 0924df6

Browse files
authored
Merge pull request #92 from github/copilot/fix-jbang-example-dependency-version
Fix corrupted dependency versions caused by release workflow sed patterns
2 parents 3dbb1f5 + a7e9b31 commit 0924df6

8 files changed

Lines changed: 28 additions & 28 deletions

File tree

.github/workflows/publish-maven.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ jobs:
8585
exit 1
8686
fi
8787
else
88-
# Split version: supports both "0.1.32" and "0.1.32-java.0" formats
88+
# Split version: supports "0.1.32", "0.1.32-java.0", and "0.1.32-java-preview.0" formats
8989
# Validate RELEASE_VERSION format explicitly to provide clear errors
90-
if ! echo "$RELEASE_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?$'; then
91-
echo "Error: RELEASE_VERSION '$RELEASE_VERSION' is invalid. Expected format: M.M.P or M.M.P-java.N (e.g., 1.2.3 or 1.2.3-java.0)." >&2
90+
if ! echo "$RELEASE_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-java(-preview)?\.[0-9]+)?$'; then
91+
echo "Error: RELEASE_VERSION '$RELEASE_VERSION' is invalid. Expected format: M.M.P, M.M.P-java.N, or M.M.P-java-preview.N (e.g., 1.2.3, 1.2.3-java.0, or 1.2.3-java-preview.0)." >&2
9292
exit 1
9393
fi
9494
# Extract the base M.M.P portion (before any qualifier)
@@ -121,21 +121,21 @@ jobs:
121121
# Update CHANGELOG.md with release version and Reference implementation sync hash
122122
./.github/scripts/release/update-changelog.sh "${VERSION}" "${REFERENCE_IMPL_HASH}"
123123
124-
# Update version in README.md (supports versions like 1.0.0 and 0.1.32-java.0)
125-
sed -i "s|<version>[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}</version>|<version>${VERSION}</version>|g" README.md
126-
sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" README.md
124+
# Update version in README.md (supports versions like 1.0.0, 0.1.32-java.0, and 0.3.0-java-preview.0)
125+
sed -i "s|<version>[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\(-preview\)\{0,1\}\.[0-9][0-9]*\)\{0,1\}</version>|<version>${VERSION}</version>|g" README.md
126+
sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\(-preview\)\{0,1\}\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" README.md
127127
128128
# Update snapshot version in README.md
129129
DEV_VERSION="${{ steps.versions.outputs.dev_version }}"
130-
sed -i "s|<version>[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}-SNAPSHOT</version>|<version>${DEV_VERSION}</version>|g" README.md
130+
sed -i "s|<version>[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\(-preview\)\{0,1\}\.[0-9][0-9]*\)\{0,1\}-SNAPSHOT</version>|<version>${DEV_VERSION}</version>|g" README.md
131131
132132
# Update version in jbang-example.java
133-
sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" jbang-example.java
133+
sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\(-preview\)\{0,1\}\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" jbang-example.java
134134
sed -i 's|copilot-sdk-java:${project\.version}|copilot-sdk-java:'"${VERSION}"'|g' jbang-example.java
135135
136136
# Update version in cookbook files (hardcoded for direct GitHub browsing and JBang usage)
137137
find src/site/markdown/cookbook -name "*.md" -type f -exec \
138-
sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" {} \;
138+
sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\(-preview\)\{0,1\}\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" {} \;
139139
140140
# Commit the documentation changes before release:prepare (requires clean working directory)
141141
git add CHANGELOG.md README.md jbang-example.java src/site/markdown/cookbook/
@@ -206,7 +206,7 @@ jobs:
206206
207207
# Get the previous tag for generating notes
208208
PREV_TAG=$(git tag --list 'v*' --sort=-version:refname \
209-
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?$' \
209+
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-java(-preview)?\.[0-9]+)?$' \
210210
| grep -Fxv "${CURRENT_TAG}" \
211211
| head -n 1)
212212

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Java SDK for programmatic control of GitHub Copilot CLI, enabling you to build A
3333
<dependency>
3434
<groupId>com.github</groupId>
3535
<artifactId>copilot-sdk-java</artifactId>
36-
<version>0.3.0-java-preview.0</version>
36+
<version>0.3.0-java-preview.1</version>
3737
</dependency>
3838
```
3939

@@ -60,7 +60,7 @@ Snapshot builds of the next development version are published to Maven Central S
6060
### Gradle
6161

6262
```groovy
63-
implementation 'com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0'
63+
implementation 'com.github:copilot-sdk-java:0.3.0-java-preview.1'
6464
```
6565

6666
## Quick Start

jbang-example.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
!
2-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
2+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
33
import com.github.copilot.sdk.CopilotClient;
44
import com.github.copilot.sdk.generated.AssistantMessageEvent;
55
import com.github.copilot.sdk.generated.SessionUsageInfoEvent;

src/site/markdown/cookbook/error-handling.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jbang BasicErrorHandling.java
3030

3131
**Code:**
3232
```java
33-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
33+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
3434
import com.github.copilot.sdk.CopilotClient;
3535
import com.github.copilot.sdk.generated.AssistantMessageEvent;
3636
import com.github.copilot.sdk.json.MessageOptions;
@@ -64,7 +64,7 @@ public class BasicErrorHandling {
6464
## Handling specific error types
6565

6666
```java
67-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
67+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
6868
import com.github.copilot.sdk.CopilotClient;
6969
import java.util.concurrent.ExecutionException;
7070

@@ -99,7 +99,7 @@ public class SpecificErrorHandling {
9999
## Timeout handling
100100

101101
```java
102-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
102+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
103103
import com.github.copilot.sdk.CopilotSession;
104104
import com.github.copilot.sdk.generated.AssistantMessageEvent;
105105
import com.github.copilot.sdk.json.MessageOptions;
@@ -130,7 +130,7 @@ public class TimeoutHandling {
130130
## Aborting a request
131131

132132
```java
133-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
133+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
134134
import com.github.copilot.sdk.CopilotSession;
135135
import com.github.copilot.sdk.json.MessageOptions;
136136
import java.util.concurrent.Executors;
@@ -162,7 +162,7 @@ public class AbortRequest {
162162
## Graceful shutdown
163163

164164
```java
165-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
165+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
166166
import com.github.copilot.sdk.CopilotClient;
167167

168168
public class GracefulShutdown {
@@ -192,7 +192,7 @@ public class GracefulShutdown {
192192
## Try-with-resources pattern
193193

194194
```java
195-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
195+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
196196
import com.github.copilot.sdk.CopilotClient;
197197
import com.github.copilot.sdk.generated.AssistantMessageEvent;
198198
import com.github.copilot.sdk.json.MessageOptions;
@@ -224,7 +224,7 @@ public class TryWithResources {
224224
## Handling tool errors
225225

226226
```java
227-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
227+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
228228
import com.github.copilot.sdk.CopilotClient;
229229
import com.github.copilot.sdk.generated.AssistantMessageEvent;
230230
import com.github.copilot.sdk.json.MessageOptions;

src/site/markdown/cookbook/managing-local-files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jbang ManagingLocalFiles.java
3434

3535
**Code:**
3636
```java
37-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
37+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
3838
import com.github.copilot.sdk.CopilotClient;
3939
import com.github.copilot.sdk.generated.AssistantMessageEvent;
4040
import com.github.copilot.sdk.generated.SessionIdleEvent;
@@ -161,7 +161,7 @@ session.send(new MessageOptions().setPrompt(prompt));
161161
## Interactive file organization
162162

163163
```java
164-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
164+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
165165
import java.io.BufferedReader;
166166
import java.io.InputStreamReader;
167167

src/site/markdown/cookbook/multiple-sessions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jbang MultipleSessions.java
3030

3131
**Code:**
3232
```java
33-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
33+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
3434
import com.github.copilot.sdk.CopilotClient;
3535
import com.github.copilot.sdk.generated.AssistantMessageEvent;
3636
import com.github.copilot.sdk.json.MessageOptions;
@@ -123,7 +123,7 @@ try {
123123
## Managing session lifecycle with CompletableFuture
124124

125125
```java
126-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
126+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
127127
import java.util.concurrent.CompletableFuture;
128128
import java.util.List;
129129

src/site/markdown/cookbook/persisting-sessions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jbang PersistingSessions.java
3030

3131
**Code:**
3232
```java
33-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
33+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
3434
import com.github.copilot.sdk.CopilotClient;
3535
import com.github.copilot.sdk.generated.AssistantMessageEvent;
3636
import com.github.copilot.sdk.json.MessageOptions;
@@ -127,7 +127,7 @@ public class DeleteSession {
127127
## Getting session history
128128

129129
```java
130-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
130+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
131131
import com.github.copilot.sdk.CopilotClient;
132132
import com.github.copilot.sdk.generated.AssistantMessageEvent;
133133
import com.github.copilot.sdk.generated.UserMessageEvent;
@@ -162,7 +162,7 @@ public class SessionHistory {
162162
## Complete example with session management
163163

164164
```java
165-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
165+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
166166
import java.util.Scanner;
167167

168168
public class SessionManager {

src/site/markdown/cookbook/pr-visualization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jbang PRVisualization.java github/copilot-sdk
3434
## Full example: PRVisualization.java
3535

3636
```java
37-
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1-java-preview.0
37+
//DEPS com.github:copilot-sdk-java:0.3.0-java-preview.1
3838
import com.github.copilot.sdk.CopilotClient;
3939
import com.github.copilot.sdk.generated.AssistantMessageEvent;
4040
import com.github.copilot.sdk.generated.ToolExecutionStartEvent;

0 commit comments

Comments
 (0)