-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (45 loc) · 1.66 KB
/
Copy pathmaven.yml
File metadata and controls
56 lines (45 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
push:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
# 第一步:下载源码
- name: Checkout
uses: actions/checkout@v3
# 第二步:打包构建
- name: setup jdk
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Build
run: mvn -B package --file pom.xml
- name: staging
run: mkdir staging && cp target/*full.jar staging
# 第三步: 设置 jobs Maven pom 版本环境变量
- name: Set Release version env variable
run: |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: "Build & test"
run: |
echo "done!"
# 第四步:上传构建结果到 Release
- name: Upload jar release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: ${{ secrets.TOKEN }}
automatic_release_tag: ${{ env.RELEASE_VERSION }}
prerelease: false
title: Release ${{ env.RELEASE_VERSION }}
files: |
staging/*.jar