4040 runs-on : windows-latest
4141 permissions :
4242 contents : read
43+ outputs :
44+ version : ${{ steps.build.outputs.version }}
4345 defaults :
4446 run :
4547 shell : pwsh
9395 if-no-files-found : error
9496 retention-days : 1
9597
98+ build-darwin-classifier :
99+ name : Build Darwin snapshot classifier
100+ needs : resolve-source
101+ runs-on : macos-26
102+ permissions :
103+ contents : read
104+ outputs :
105+ version : ${{ steps.build.outputs.version }}
106+ defaults :
107+ run :
108+ shell : bash
109+ working-directory : ./java
110+ steps :
111+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
112+ with :
113+ ref : ${{ github.sha }}
114+ fetch-depth : 1
115+ persist-credentials : false
116+
117+ - uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
118+ with :
119+ java-version : " 25"
120+ distribution : " microsoft"
121+ cache : " maven"
122+
123+ - uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
124+ with :
125+ node-version : 22
126+
127+ - name : Build and validate darwin-arm64 classifier
128+ id : build
129+ run : |
130+ set -euo pipefail
131+ SOURCE_COMMIT=$(git rev-parse HEAD)
132+ if [ "$SOURCE_COMMIT" != "${{ needs.resolve-source.outputs.source_sha }}" ]; then
133+ echo "::error::Checked out $SOURCE_COMMIT instead of the resolved snapshot source."
134+ exit 1
135+ fi
136+ node copilot-native/scripts/validate-native-host.mjs darwin-arm64
137+ mvn -B -pl copilot-native package -DskipTests
138+ VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
139+ JAR="copilot-native/target/copilot-sdk-java-runtime-$VERSION-darwin-arm64.jar"
140+ PRIMARY_JAR="copilot-native/target/copilot-sdk-java-runtime-$VERSION.jar"
141+ test -f "$JAR"
142+ node copilot-native/scripts/validate-native-artifact.mjs \
143+ classifier darwin-arm64 "$JAR" "$(basename "$JAR")" ..
144+ node copilot-native/scripts/validate-native-artifact.mjs placeholder "$PRIMARY_JAR"
145+ MANIFEST="copilot-native/target/darwin-arm64-$VERSION.sha256"
146+ HASH=$(shasum -a 256 "$JAR" | cut -d ' ' -f 1)
147+ printf '%s %s' "$HASH" "$(basename "$JAR")" > "$MANIFEST"
148+ node copilot-native/scripts/validate-native-artifact.mjs \
149+ checksum "$JAR" "$MANIFEST" "$(basename "$JAR")"
150+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
151+
152+ - uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
153+ with :
154+ name : java-native-darwin-arm64-snapshot-${{ github.run_id }}-${{ github.run_attempt }}
155+ path : |
156+ java/copilot-native/target/copilot-sdk-java-runtime-${{ steps.build.outputs.version }}-darwin-arm64.jar
157+ java/copilot-native/target/darwin-arm64-${{ steps.build.outputs.version }}.sha256
158+ if-no-files-found : error
159+ retention-days : 1
160+
96161 deploy-snapshot :
97162 name : Publish SNAPSHOT to Maven Central
98- needs : [resolve-source, build-windows-classifier]
163+ needs : [resolve-source, build-windows-classifier, build-darwin-classifier ]
99164 runs-on : ubuntu-latest
100165 defaults :
101166 run :
@@ -128,6 +193,11 @@ jobs:
128193 name : java-native-win32-x64-snapshot-${{ github.run_id }}-${{ github.run_attempt }}
129194 path : ${{ runner.temp }}/java-native-win32-x64
130195
196+ - uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
197+ with :
198+ name : java-native-darwin-arm64-snapshot-${{ github.run_id }}-${{ github.run_attempt }}
199+ path : ${{ runner.temp }}/java-native-darwin-arm64
200+
131201 - name : Verify version, source, and Windows classifier
132202 id : windows-artifact
133203 run : |
@@ -141,6 +211,10 @@ jobs:
141211 echo "::error::This workflow only publishes SNAPSHOT versions. Current version: $VERSION"
142212 exit 1
143213 fi
214+ if [ "$VERSION" != "${{ needs.build-windows-classifier.outputs.version }}" ]; then
215+ echo "::error::Windows classifier version does not match deploy version."
216+ exit 1
217+ fi
144218 ARTIFACT_DIRECTORY="${{ runner.temp }}/java-native-win32-x64"
145219 JAR="$ARTIFACT_DIRECTORY/copilot-sdk-java-runtime-$VERSION-win32-x64.jar"
146220 MANIFEST="$ARTIFACT_DIRECTORY/win32-x64-$VERSION.sha256"
@@ -154,11 +228,37 @@ jobs:
154228 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
155229 echo "windows_sha=$(cut -d ' ' -f 1 "$MANIFEST")" >> "$GITHUB_OUTPUT"
156230
231+ - name : Verify version, source, and Darwin classifier
232+ id : darwin-artifact
233+ run : |
234+ SOURCE_COMMIT=$(git rev-parse HEAD)
235+ if [ "$SOURCE_COMMIT" != "${{ needs.resolve-source.outputs.source_sha }}" ]; then
236+ echo "::error::Checked out $SOURCE_COMMIT instead of the resolved snapshot source."
237+ exit 1
238+ fi
239+ VERSION="${{ steps.windows-artifact.outputs.version }}"
240+ if [ "$VERSION" != "${{ needs.build-darwin-classifier.outputs.version }}" ]; then
241+ echo "::error::Darwin classifier version does not match deploy version."
242+ exit 1
243+ fi
244+ ARTIFACT_DIRECTORY="${{ runner.temp }}/java-native-darwin-arm64"
245+ JAR="$ARTIFACT_DIRECTORY/copilot-sdk-java-runtime-$VERSION-darwin-arm64.jar"
246+ MANIFEST="$ARTIFACT_DIRECTORY/darwin-arm64-$VERSION.sha256"
247+ test -f "$JAR"
248+ test -f "$MANIFEST"
249+ node "$GITHUB_WORKSPACE/java/copilot-native/scripts/validate-native-artifact.mjs" \
250+ checksum "$JAR" "$MANIFEST" "$(basename "$JAR")"
251+ node "$GITHUB_WORKSPACE/java/copilot-native/scripts/validate-native-artifact.mjs" \
252+ classifier darwin-arm64 "$JAR" "$(basename "$JAR")" "$GITHUB_WORKSPACE"
253+ echo "darwin_jar=$JAR" >> "$GITHUB_OUTPUT"
254+ echo "darwin_sha=$(cut -d ' ' -f 1 "$MANIFEST")" >> "$GITHUB_OUTPUT"
255+
157256 - name : Build Linux classifier and deploy complete snapshot
158257 run : |
159258 VERSION="${{ steps.windows-artifact.outputs.version }}"
160259 mvn -B deploy -DskipTests -Dcopilot.native.libc=glibc \
161- "-Dcopilot.native.external.win32.classifier.path=${{ steps.windows-artifact.outputs.windows_jar }}"
260+ "-Dcopilot.native.external.win32.classifier.path=${{ steps.windows-artifact.outputs.windows_jar }}" \
261+ "-Dcopilot.native.external.darwin.classifier.path=${{ steps.darwin-artifact.outputs.darwin_jar }}"
162262 LINUX_JAR="copilot-native/target/copilot-sdk-java-runtime-$VERSION-linux-x64.jar"
163263 test -f "$LINUX_JAR"
164264 node copilot-native/scripts/validate-native-artifact.mjs \
@@ -176,6 +276,7 @@ jobs:
176276 echo "| --- | --- | --- | --- | --- |"
177277 echo "| \`linux-x64\` | \`ubuntu-latest\` | \`$(basename "$LINUX_JAR")\` | \`$LINUX_SHA\` | Published |"
178278 echo "| \`win32-x64\` | \`windows-latest\` | \`$(basename "${{ steps.windows-artifact.outputs.windows_jar }}")\` | \`${{ steps.windows-artifact.outputs.windows_sha }}\` | Published |"
279+ echo "| \`darwin-arm64\` | \`macos-26\` | \`$(basename "${{ steps.darwin-artifact.outputs.darwin_jar }}")\` | \`${{ steps.darwin-artifact.outputs.darwin_sha }}\` | Published |"
179280 } >> "$GITHUB_STEP_SUMMARY"
180281 env :
181282 MAVEN_USERNAME : ${{ secrets.JAVA_MAVEN_CENTRAL_USERNAME }}
0 commit comments