mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-26 17:20:52 +00:00
ci: 创建 GitHub Actions 工作流自动发布版本
This commit is contained in:
parent
1081b8e10a
commit
d955b11165
54
.github/workflows/release.yml
vendored
Normal file
54
.github/workflows/release.yml
vendored
Normal file
@ -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
|
@ -130,5 +130,29 @@
|
|||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
<zip destfile='${project.build.directory}/build/sql.zip'>
|
||||||
|
<zipfileset filemode="755" dir='${basedir}/../doc/sql'/>
|
||||||
|
</zip>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
Loading…
x
Reference in New Issue
Block a user