Skip to content

Commit f53f221

Browse files
committed
feat[API-1931]: add GitHub Releases workflow for binary distribution
1 parent 0d141d5 commit f53f221

5 files changed

Lines changed: 101 additions & 4 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Release package to GitHub Releases
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
description: "Release tag (e.g. v2.0.3)"
7+
required: true
8+
push:
9+
tags:
10+
- "v*"
11+
permissions:
12+
contents: write
13+
concurrency:
14+
group: release-${{ github.ref }}
15+
cancel-in-progress: false
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: checkout
21+
uses: actions/checkout@v4
22+
- name: setup java/maven
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: '8'
26+
distribution: 'temurin'
27+
cache: maven
28+
- name: resolve tag
29+
id: tag
30+
run: |
31+
set -euo pipefail
32+
if [ -n "${{ github.event.inputs.tag }}" ]; then
33+
echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
34+
else
35+
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
36+
fi
37+
- name: verify version consistency
38+
env:
39+
VERSION: ${{ steps.tag.outputs.tag }}
40+
run: |
41+
set -euo pipefail
42+
POM_VERSION=$(mvn -q help:evaluate -Dexpression=project.version -DforceStdout -pl webull-openapi-java-sdk)
43+
TAG_VERSION="${VERSION#v}" # strip leading 'v'
44+
if [ "$POM_VERSION" != "$TAG_VERSION" ]; then
45+
echo "::error::Tag version ($TAG_VERSION) does not match pom.xml version ($POM_VERSION)"
46+
exit 1
47+
fi
48+
echo "Version verified: $POM_VERSION"
49+
- name: package with sources and javadoc
50+
run: mvn --batch-mode -pl webull-openapi-java-sdk -am package source:jar javadoc:jar -DskipTests -Dmaven.javadoc.failOnError=false
51+
- name: assemble dist
52+
env:
53+
VERSION: ${{ steps.tag.outputs.tag }}
54+
run: |
55+
set -euo pipefail
56+
mkdir -p dist
57+
STAGE="dist/webull-openapi-java-sdk-${VERSION}"
58+
mkdir -p "${STAGE}"
59+
cp webull-openapi-java-sdk/target/webull-openapi-java-sdk-*.jar "${STAGE}/"
60+
cp README.md LICENSE.txt NOTICE.txt "${STAGE}/" 2>/dev/null || true
61+
cp -r licenses "${STAGE}/licenses"
62+
63+
pushd "${STAGE}" > /dev/null
64+
zip -r "../webull-openapi-java-sdk-${VERSION}.zip" .
65+
tar cfz "../webull-openapi-java-sdk-${VERSION}.tar.gz" .
66+
popd > /dev/null
67+
68+
# checksums are computed over the archive files themselves
69+
( cd dist && shasum -a 256 *.zip *.tar.gz > SHA256SUMS )
70+
- name: list artifacts
71+
run: |
72+
echo "=== Artifacts to be released ==="
73+
ls -lh dist/
74+
echo "=== Contents of archive ==="
75+
unzip -l dist/webull-openapi-java-sdk-*.zip | head -30
76+
- name: publish release
77+
env:
78+
GH_TOKEN: ${{ github.token }}
79+
VERSION: ${{ steps.tag.outputs.tag }}
80+
run: |
81+
set -euo pipefail
82+
if gh release view "${VERSION}" --repo "${GITHUB_REPOSITORY}" > /dev/null 2>&1; then
83+
gh release upload "${VERSION}" \
84+
dist/webull-openapi-java-sdk-*.zip \
85+
dist/webull-openapi-java-sdk-*.tar.gz \
86+
dist/SHA256SUMS \
87+
--repo "${GITHUB_REPOSITORY}" \
88+
--clobber
89+
else
90+
gh release create "${VERSION}" \
91+
dist/webull-openapi-java-sdk-*.zip \
92+
dist/webull-openapi-java-sdk-*.tar.gz \
93+
dist/SHA256SUMS \
94+
--repo "${GITHUB_REPOSITORY}" \
95+
--title "${VERSION}" \
96+
--generate-notes
97+
fi

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<groupId>com.webull.openapi</groupId>
2222
<artifactId>webull-openapi-java-sdk-parent</artifactId>
2323
<packaging>pom</packaging>
24-
<version>2.0.4</version>
24+
<version>2.0.5</version>
2525

2626
<name>webull-openapi-java-sdk-parent</name>
2727
<url>https://github.com/webull-inc/webull-openapi-java-sdk/</url>

‎webull-openapi-java-sdk-samples/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<parent>
2020
<groupId>com.webull.openapi</groupId>
2121
<artifactId>webull-openapi-java-sdk-parent</artifactId>
22-
<version>2.0.4</version>
22+
<version>2.0.5</version>
2323
</parent>
2424
<modelVersion>4.0.0</modelVersion>
2525

‎webull-openapi-java-sdk/pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.webull.openapi</groupId>
99
<artifactId>webull-openapi-java-sdk-parent</artifactId>
10-
<version>2.0.4</version>
10+
<version>2.0.5</version>
1111
</parent>
1212

1313
<artifactId>webull-openapi-java-sdk</artifactId>

‎webull-openapi-java-sdk/src/main/java/com/webull/openapi/core/config/ProjectReaderHelper.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private ProjectReaderHelper() {
2424

2525
private static final String APPLICATION_VERSION = "application.version";
2626

27-
private static final String DEFAULT_APPLICATION_VERSION = "2.0.4";
27+
private static final String DEFAULT_APPLICATION_VERSION = "2.0.5";
2828

2929
private static final String APPLICATION_NAME = "application.name";
3030

0 commit comments

Comments
 (0)