-
Notifications
You must be signed in to change notification settings - Fork 19
76 lines (64 loc) · 2.5 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
64
65
66
67
68
69
70
71
72
73
74
75
76
name: CI
on:
push:
branches: [ master, develop ]
jobs:
compare-lang-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependency
run: npm install yaml
- name: Compare lang files
run: node scripts/compare-lang-files.js
build:
runs-on: ubuntu-latest
needs: [ compare-lang-files ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Initialize Maven
run: mvn initialize
- name: Build with Maven
run: mvn -B --no-transfer-progress package
- name: Set outputs
id: variables
run: |
echo "::set-output name=artifact_id::$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)"
echo "::set-output name=tag_name::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
echo "::set-output name=short_sha::$(git rev-parse --short ${{ github.event.after }})"
echo "::set-output name=commits::$(git log --pretty=format:"%s" ${{ github.event.before }}..${{ github.event.after }})"
echo "::set-output name=branch::$(echo ${GITHUB_REF##*/})"
- name: Release build
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.variables.outputs.tag_name }}-SNAPSHOT-${{ steps.variables.outputs.short_sha }}
release_name: ${{ steps.variables.outputs.branch }}-${{ steps.variables.outputs.short_sha }}
prerelease: ${{ steps.variables.outputs.branch != 'master' }}
- name: Upload plugin .jar to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ steps.variables.outputs.artifact_id }}-${{ steps.variables.outputs.tag_name }}.jar
asset_name: ${{ steps.variables.outputs.artifact_id }}.jar
asset_content_type: application/java-archive