Sitelet https://github.com/NodeOps-app/createos-java-sdk/commit/9efd27e7ecba27db5ae62a73716ed0fe467a2058
Skip to content

Commit 9efd27e

Browse files
build(release): publish 0.1.0 from version tags
1 parent 7fb8a6c commit 9efd27e

4 files changed

Lines changed: 155 additions & 11 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]*'
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: release-${{ github.ref }}
13+
cancel-in-progress: false
14+
15+
jobs:
16+
validate:
17+
name: Validate release tag
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v7
21+
with:
22+
fetch-depth: 0
23+
- uses: actions/setup-java@v6
24+
with:
25+
distribution: temurin
26+
java-version: '17'
27+
cache: maven
28+
- name: Require a main-branch SemVer tag matching the POM
29+
shell: bash
30+
run: |
31+
if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
32+
echo "Release tags must use vMAJOR.MINOR.PATCH" >&2
33+
exit 1
34+
fi
35+
if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
36+
echo "Release tag must point to a commit on main" >&2
37+
exit 1
38+
fi
39+
pom_version="$(mvn --batch-mode --no-transfer-progress -q \
40+
help:evaluate -Dexpression=project.version -DforceStdout)"
41+
if [[ "$pom_version" != "${GITHUB_REF_NAME#v}" ]]; then
42+
echo "POM version $pom_version does not match tag $GITHUB_REF_NAME" >&2
43+
exit 1
44+
fi
45+
46+
verify:
47+
name: Verify Java ${{ matrix.java-version }}
48+
needs: validate
49+
runs-on: ubuntu-latest
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
java-version: ['17', '21', '25']
54+
steps:
55+
- uses: actions/checkout@v7
56+
- uses: actions/setup-java@v6
57+
with:
58+
distribution: temurin
59+
java-version: ${{ matrix.java-version }}
60+
cache: maven
61+
- name: Verify SDK, examples, documentation, and package artifacts
62+
run: mvn --batch-mode --no-transfer-progress verify
63+
64+
publish:
65+
name: Publish Maven package and GitHub Release
66+
needs: verify
67+
runs-on: ubuntu-latest
68+
permissions:
69+
contents: write
70+
packages: write
71+
steps:
72+
- uses: actions/checkout@v7
73+
- uses: actions/setup-java@v6
74+
with:
75+
distribution: temurin
76+
java-version: '17'
77+
cache: maven
78+
server-id: github
79+
server-username-env-var: GITHUB_ACTOR
80+
server-password-env-var: GITHUB_TOKEN
81+
- name: Publish to GitHub Packages
82+
run: mvn --batch-mode --no-transfer-progress deploy
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
- name: Create GitHub Release with built artifacts
86+
run: gh release create "$GITHUB_REF_NAME" target/*.jar --verify-tag --generate-notes --title "$GITHUB_REF_NAME"
87+
env:
88+
GH_TOKEN: ${{ github.token }}

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Versioning and the Keep a Changelog structure.
55

66
## Unreleased
77

8+
## 0.1.0 - 2026-09-16
9+
810
### Added
911

1012
- Initial Java 17 SDK for CreateOS Sandbox
@@ -13,3 +15,4 @@ Versioning and the Keep a Changelog structure.
1315
- Compile-checked examples corresponding to the Go SDK examples
1416
- Authentication, path-isolation, pagination, and transport contract tests
1517
- Google Java formatting, Checkstyle, JaCoCo, Javadocs, and publication artifacts
18+
- Tag-triggered GitHub Packages and GitHub Release publishing

‎README.md‎

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,46 @@ open a preview URL, and tear everything down from Java.
55

66
## Your first sandbox
77

8-
The SDK currently ships as a development snapshot. Install it locally:
8+
After the `v0.1.0` tag is released, add the GitHub Packages Maven repository and
9+
the SDK dependency to your project:
910

10-
```sh
11-
mvn install
11+
```xml
12+
<repositories>
13+
<repository>
14+
<id>github</id>
15+
<url>https://maven.pkg.github.com/NodeOps-app/createos-java-sdk</url>
16+
</repository>
17+
</repositories>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>network.nodeops</groupId>
22+
<artifactId>createos-java-sdk</artifactId>
23+
<version>0.1.0</version>
24+
</dependency>
25+
</dependencies>
1226
```
1327

14-
Then add it to a Maven project:
28+
GitHub Packages requires authentication to download Maven packages, including
29+
public packages. Put a GitHub personal access token (classic) with
30+
`read:packages` in your environment, not your project source. Configure Maven
31+
to read it from `~/.m2/settings.xml`:
1532

1633
```xml
17-
<dependency>
18-
<groupId>network.nodeops</groupId>
19-
<artifactId>createos-java-sdk</artifactId>
20-
<version>0.1.0-SNAPSHOT</version>
21-
</dependency>
34+
<settings>
35+
<servers>
36+
<server>
37+
<id>github</id>
38+
<username>${env.GITHUB_USERNAME}</username>
39+
<password>${env.GITHUB_TOKEN}</password>
40+
</server>
41+
</servers>
42+
</settings>
2243
```
2344

45+
For local development from this checkout, run `mvn install` instead of
46+
configuring GitHub Packages.
47+
2448
The compile-checked [hello-world example](examples/src/main/java/network/nodeops/createos/examples/helloworld/HelloWorld.java)
2549
creates a sandbox, runs a command, prints its output, and always destroys the
2650
resource:
@@ -342,7 +366,7 @@ JAR. Live execution is opt-in because it creates real CreateOS resources.
342366
Use Java 17 or newer and Maven 3.9 or newer:
343367

344368
```sh
345-
make install
369+
mvn install
346370
make format
347371
make check
348372
make test
@@ -356,6 +380,22 @@ CI compiles the SDK and every example on Java 17, 21, and 25; runs JUnit and
356380
the coverage gate; verifies Google Java formatting; requires zero Checkstyle
357381
warnings; and builds source and Javadoc JARs.
358382

383+
## Releases
384+
385+
An annotated `vMAJOR.MINOR.PATCH` tag on a commit in `main` triggers the
386+
[release workflow](.github/workflows/release.yml). It requires the tag to match
387+
the version in `pom.xml`, verifies Java 17, 21, and 25, publishes the Maven
388+
package with source and Javadoc JARs to GitHub Packages, and creates a GitHub
389+
Release with the same artifacts. The workflow uses the repository's
390+
`GITHUB_TOKEN`; no personal token is needed for publishing from Actions.
391+
392+
For the first release, push the committed version bump before tagging:
393+
394+
```sh
395+
git tag -a v0.1.0 -m "Release 0.1.0"
396+
git push origin v0.1.0
397+
```
398+
359399
## Package layout
360400

361401
```text

‎pom.xml‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>network.nodeops</groupId>
88
<artifactId>createos-java-sdk</artifactId>
9-
<version>0.1.0-SNAPSHOT</version>
9+
<version>0.1.0</version>
1010
<name>CreateOS Java SDK</name>
1111
<description>Java SDK for CreateOS Sandbox</description>
1212
<url>https://github.com/NodeOps-app/createos-java-sdk</url>
@@ -39,6 +39,14 @@
3939
<url>https://github.com/NodeOps-app/createos-java-sdk/issues</url>
4040
</issueManagement>
4141

42+
<distributionManagement>
43+
<repository>
44+
<id>github</id>
45+
<name>GitHub Packages</name>
46+
<url>https://maven.pkg.github.com/NodeOps-app/createos-java-sdk</url>
47+
</repository>
48+
</distributionManagement>
49+
4250
<properties>
4351
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4452
<maven.compiler.release>17</maven.compiler.release>
@@ -70,6 +78,11 @@
7078

7179
<build>
7280
<plugins>
81+
<plugin>
82+
<groupId>org.apache.maven.plugins</groupId>
83+
<artifactId>maven-deploy-plugin</artifactId>
84+
<version>3.1.4</version>
85+
</plugin>
7386
<plugin>
7487
<groupId>org.apache.maven.plugins</groupId>
7588
<artifactId>maven-enforcer-plugin</artifactId>

0 commit comments

Comments
 (0)