Skip to content

Commit

Permalink
cicd(CHN-208): upload and download artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff-Tian committed Mar 22, 2024
1 parent 0f22bb4 commit 9d76e9f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ jobs:
run: mvn clean test
- name: Build with Maven
run: mvn -B package --file pom.xml

# 上传生成的文件作为 Artifact
- name: Upload Maven package
uses: actions/upload-artifact@v2
with:
name: java-artifacts
path: target/
49 changes: 30 additions & 19 deletions .github/workflows/mavenpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,43 @@ name: Maven Package

on:
release:
types: [released]
types: [ released ]
workflow_run:
workflows: [ "Java CI with Maven", "Release Workflow" ]
branches: [ master ]
types:
- completed

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 18
uses: actions/setup-java@v1
with:
java-version: 18
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Test
run: mvn clean test

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
- uses: actions/checkout@v4

- name: Download Java CI with Maven artifacts
uses: actions/download-artifact@v2
with:
name: java-artifacts
path: ${{ github.workspace }}/java-artifacts

- name: Set up JDK 18
uses: actions/setup-java@v1
with:
java-version: 18
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Publish to GitHub Packages Apache Maven
run:
mv ${{ github.workspace }}/java-artifacts/* $GITHUB_WORKSPACE
pwd
ls
ls -l $GITHUB_WORKSPACE
mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}

# - name: Set up Apache Maven Central
# uses: actions/setup-java@v1
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>org.keycloak</groupId>
<artifactId>keycloak-services-social-weixin</artifactId>
<packaging>jar</packaging>
<version>0.5.14</version>
<version>0.5.15</version>

<name>Keycloak Services Social WeiXin</name>
<description>Keycloak 微信登录插件,支持 PC 端扫码登录、关注公众号即登录、手机微信等登录方式。</description>
Expand Down

0 comments on commit 9d76e9f

Please sign in to comment.