-
Notifications
You must be signed in to change notification settings - Fork 10
101 lines (98 loc) · 3.24 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
91
92
93
94
95
96
97
98
99
100
101
# Pass the arguments you wish to run to maven_commands variable, default command will be mvn install
---
name: Maven
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0'
jobs:
build:
strategy:
matrix:
java: [8, 11, 17]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
env:
maven_commands: install # default is install
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
- name: Build
run: mvn ${{ env.maven_commands }}
- name: Upload JAR as artifact
if: matrix.os == 'ubuntu-latest' && matrix.java == '1.8'
uses: actions/upload-artifact@v2
with:
name: ZarrReader
path: target/*.jar
deploy_snapshots:
if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'ome' }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Retrieve version
id: get_version
run: |
VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set server
id: set_server
run: |
if [[ ${{ steps.get_version.outputs.version }} =~ 'SNAPSHOT' ]]; then
echo server='ome.snapshots' >> $GITHUB_OUTPUT
else
echo server='ome.staging' >> $GITHUB_OUTPUT
fi
- name: Set up Repository
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
server-id: ${{ steps.set_server.outputs.server }}
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Deploy SNAPSHOT
if: ${{ steps.set_server.outputs.server == 'ome.snapshots' }}
run: mvn deploy
env:
MAVEN_USERNAME: ${{ secrets.CI_DEPLOY_USER }}
MAVEN_PASSWORD: ${{ secrets.CI_DEPLOY_PASS }}
deploy_tags:
if: startsWith(github.ref, 'refs/tags') && github.repository_owner == 'ome'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Retrieve version
id: get_version
run: |
VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set server
id: set_server
run: |
if [[ ${{ steps.get_version.outputs.version }} =~ 'SNAPSHOT' ]]; then
echo server='ome.snapshots' >> $GITHUB_OUTPUT
else
echo server='ome.releases' >> $GITHUB_OUTPUT
fi
- name: Set up Repository
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'zulu'
server-id: ${{ steps.set_server.outputs.server }}
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Deploy Tags
if: ${{ steps.set_server.outputs.server == 'ome.releases' }}
run: mvn deploy
env:
MAVEN_USERNAME: ${{ secrets.CI_DEPLOY_USER }}
MAVEN_PASSWORD: ${{ secrets.CI_DEPLOY_PASS }}