Skip to content

Commit 6d29a51

Browse files
authored
Merge pull request #85 from zong-zhe/fix-release-ci
fix: fix github action java release
2 parents 3cd1271 + 924e35b commit 6d29a51

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

.github/workflows/java-test.yaml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
path: |
8989
java/target/classes/native
9090
91-
add-centos7-jni-and-deploy:
91+
build-centos7:
9292
runs-on: ubuntu-latest
9393
container:
9494
image: "kcllang/kcl-java-builder-centos7:0.1.0"
@@ -136,15 +136,43 @@ jobs:
136136
name: kcl-lib
137137
path: java/target/*.jar
138138

139+
deploy:
140+
runs-on: ubuntu-latest
141+
142+
permissions:
143+
contents: read
144+
packages: write
145+
needs: [ test-and-build, build-centos7 ]
146+
steps:
147+
- name: Checkout
148+
uses: actions/checkout@v3
149+
150+
- name: Set up JDK 8
151+
uses: actions/setup-java@v4
152+
with:
153+
distribution: 'temurin'
154+
java-version: '8'
155+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
156+
settings-path: ${{ github.workspace }} # location for the settings.xml file
157+
158+
- name: Download Jar
159+
uses: actions/download-artifact@v3
160+
with:
161+
name: kcl-lib
162+
path: java/release
163+
139164
- name: Release to Github Packages
140165
if: "startsWith(github.ref, 'refs/tags/')"
141166
working-directory: java
142167
run: |
143-
mvn package deploy \
144-
-DskipTests=true \
145-
-DskipCompile=true \
146-
-Dcargo-build.profile=release \
147-
-DserverId=github \
168+
JAR_FILE=$(find ./release -name "*.jar")
169+
echo "Deploying $JAR_FILE"
170+
mvn deploy:deploy-file \
171+
-Dfile=$JAR_FILE \
172+
-DpomFile=./pom.xml \
173+
-DrepositoryId=github \
174+
-Durl=https://maven.pkg.github.com/kcl-lang/lib \
148175
-s $GITHUB_WORKSPACE/settings.xml
176+
149177
env:
150-
GITHUB_TOKEN: ${{ github.token }}
178+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)