From d955b1116564d08b01657c18bd4cbed990639529 Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <1179705413@qq.com> Date: Thu, 20 Mar 2025 12:21:45 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E5=88=9B=E5=BB=BA=20GitHub=20Actions=20?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E8=87=AA=E5=8A=A8=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 54 +++++++++++++++++++++++++++++++++++ novel-common/pom.xml | 24 ++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7a0dbeb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: Create novel-plus Maven Release with ZIPs + +on: + push: + # 匹配所有以'v'开头的标签 + tags: + - 'v*' + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + # 可选,默认是 temurin,也可以选择其他发行版 + distribution: 'temurin' + + - name: Build project with Maven + run: mvn clean install -DskipTests=true + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # 使用 tag_name 而不是 github.ref + tag_name: ${{ github.ref_name }} + release_name: novel-plus ${{ github.ref_name }} + draft: false + prerelease: false + + - name: Upload all *.zip artifacts from submodules + run: | + for module in novel-common novel-crawl novel-front novel-admin + do + for file in $(find ./$module/target/build -type f -name "*.zip") + do + asset_path="$file" + asset_name=$(basename "$file") + echo "Uploading $asset_name..." + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/zip" \ + --data-binary @"$file" \ + "${{ steps.create_release.outputs.upload_url }}?name=$asset_name" + done + done \ No newline at end of file diff --git a/novel-common/pom.xml b/novel-common/pom.xml index 1b9292b..6b4a68b 100644 --- a/novel-common/pom.xml +++ b/novel-common/pom.xml @@ -130,5 +130,29 @@ + + + + maven-antrun-plugin + 1.8 + + + package + + run + + + + + + + + + + + + + + \ No newline at end of file