Skip to content

Commit

Permalink
cicd(CHN-208): upload artifacts to release page
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff-Tian committed Mar 22, 2024
1 parent 2508928 commit adf4185
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
26 changes: 10 additions & 16 deletions .github/workflows/mavenpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ name: Maven Package

on:
release:
types: [ released ]
types: [released]

workflow_run:
workflows: [ "Release Workflow" ]
branches: [ master ]
Expand All @@ -18,29 +19,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Download Java CI with Maven artifacts
uses: actions/download-artifact@v4
with:
name: java-artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- uses: actions/checkout@v2
- 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:
mv ${{ github.workspace }}/java-artifacts/* $GITHUB_WORKSPACE
pwd
ls
ls -l $GITHUB_WORKSPACE
mvn deploy -s $GITHUB_WORKSPACE/settings.xml
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,14 @@ jobs:
release_name: Release ${{ steps.get_current_version.outputs.current_version }}
draft: false
prerelease: false

# 将生成的 artifacts 上传到 release 的附件中
- name: Upload release assets
if: steps.check_version.outputs.version_changed == 'true'
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: java-artifacts/
asset_name: java-artifacts-${{ steps.get_current_version.outputs.current_version }}.zip
asset_content_type: application/zip
token: ${{ secrets.GITHUB_TOKEN }}
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.17</version>
<version>0.5.18</version>

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

0 comments on commit adf4185

Please sign in to comment.