-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (77 loc) · 2.54 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Java Maven Build
on:
push:
branches:
- '**'
paths-ignore:
- '**/README.md'
pull_request:
branches:
- '**'
paths-ignore:
- '**/README.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'zulu'
cache: maven
- name: Show versions
run: java -version && ./mvnw -version && gpg --version
- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.OSS_SONATYPE_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.OSS_SONATYPE_GPG_PASSPHRASE }}
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSS_SONATYPE_USERNAME: michael-schnell
OSS_SONATYPE_TOKEN: ${{ secrets.OSS_SONATYPE_TOKEN }}
OSS_SONATYPE_GPG_PASSPHRASE: ${{ secrets.OSS_SONATYPE_GPG_PASSPHRASE }}
run: ./mvnw clean deploy -U -B -P sonatype-oss-release --file pom.xml -s settings.xml
- name: Project properties as ENV variables
run: |
cat ${{ github.workspace }}/target/classes/project.properties | grep "^[^#;]" >> $GITHUB_ENV
- name: Tag on build
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
try {
await github.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/${{ env.maven_version }}"
})
} catch (e) {
console.log("The ${{ env.maven_version }} tag doesn't exist yet: " + e)
}
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ env.maven_version }}",
sha: context.sha
})
- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{ env.maven_version }}
tag_name: ${{ env.maven_version }}
files: |
${{ github.workspace }}/app/target/code2svg-app-${{ env.maven_version }}-bin.zip
${{ github.workspace }}/app/target/code2svg-app-${{ env.maven_version }}-bin.tar.gz