-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (60 loc) · 1.95 KB
/
maven.yml
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
57
58
59
60
61
62
63
# 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" ]
pull_request:
branches: [ "master" ]
merge_group:
branches-ignore: [checks_requested]
create:
branches: [ "master" ]
delete:
branches: [ "master" ]
jobs:
build:
# 配置权限
permissions: write-all
runs-on: ubuntu-latest
steps:
# 下载代码
- uses: actions/checkout@v3
- name: Set up JDK 11
# 安装 JDK
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
# 配置 settings.xml 一般用于 Mavne 私库验证等
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v20
with:
repositories: ''
servers: ''
# Maven 打包
- name: Build with Maven
run: mvn -B package --file pom.xml
# 将打包好的 Jar 包 放到 staging 文件夹
- run: mkdir staging && cp target/*.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
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_VERSION }}"
prerelease: false
title: "Release ${{ env.RELEASE_VERSION }}"
files: |
staging/*.jar