-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (54 loc) · 1.63 KB
/
build-and-release-snapshot.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
name: Build and Publish Snapshot
on:
push:
branches:
- master
tags-ignore:
- '**'
paths-ignore:
- '**.md'
env:
MAVEN_OPTS: ${{ vars.MAVEN_OPTS }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
# - name: Cache Maven packages
# uses: actions/cache@v3
# with:
# path: ~/.m2
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
# restore-keys: ${{ runner.os }}-m2
- name: Prepare Maven settings.xml
run: |
cat "${{ github.workspace }}/.github/settings.xml" > ~/.m2/settings.xml
- name: Build with Maven
run: mvn --batch-mode --update-snapshots package
- name: Publish Snapshot to OSS SonaType
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: |
mvn --batch-mode --no-transfer-progress deploy \
-DskipTests \
-P oss-sonatype
- name: Notify on success
if: success()
run: |
echo "Snapshot has been successfully deployed to OSS SonaType."
- name: Notify on failure
if: failure()
run: |
echo "Snapshot deployment failed. Please check the logs for more information."