Skip to content

Commit 09cf334

Browse files
author
yrh
committed
v1.0.20 添加自动部署
1 parent 753cd8d commit 09cf334

File tree

2 files changed

+54
-33
lines changed

2 files changed

+54
-33
lines changed

.github/workflows/deployed.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release Build
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # 例如 v1.0.20 触发
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# 拉取代码
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
# 设置 JDK 1.8
18+
- name: Set up JDK 1.8
19+
uses: actions/setup-java@v3
20+
with:
21+
distribution: 'temurin'
22+
java-version: '8'
23+
24+
# 获取 Maven 项目版本号
25+
- name: Extract project version
26+
id: get_version
27+
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
28+
29+
# 使用 Maven 打包
30+
- name: Build with Maven
31+
run: mvn clean package -DskipTests
32+
33+
# 创建 Release(自动附带 Source code (zip/tar.gz))
34+
- name: Create Release
35+
id: create_release
36+
uses: actions/create-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
tag_name: ${{ github.ref_name }}
41+
release_name: Release ${{ github.ref_name }}
42+
draft: false
43+
prerelease: false
44+
45+
# 上传 JAR 包
46+
- name: Upload JAR
47+
uses: actions/upload-release-asset@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
with:
51+
upload_url: ${{ steps.create_release.outputs.upload_url }}
52+
asset_path: target/sdk-${{ env.PROJECT_VERSION }}.jar
53+
asset_name: sdk-${{ env.PROJECT_VERSION }}.jar
54+
asset_content_type: application/java-archive

0 commit comments

Comments
 (0)