-
Notifications
You must be signed in to change notification settings - Fork 512
84 lines (82 loc) · 2.6 KB
/
snapshot.yml
File metadata and controls
84 lines (82 loc) · 2.6 KB
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
name: Snapshot
on:
push:
branches:
- 2025
- 2024
- 2023
- 2022
- 2021
- 2020
- hoxton
- greenwich
- release/*
paths-ignore:
- '**.md'
jobs:
check-snapshot:
runs-on: ubuntu-latest
outputs:
IS_SNAPSHOT: ${{ steps.check-deploy-type.outputs.IS_SNAPSHOT }}
steps:
- name: Checkout codes
uses: actions/checkout@v6
- name: Check deploy type
id: check-deploy-type
run: |
line="$(grep SNAPSHOT pom.xml || true)"
echo $line
if [ -n "$line" ]; then
echo "IS_SNAPSHOT=true" >> $GITHUB_OUTPUT
else
echo "IS_SNAPSHOT=false" >> $GITHUB_OUTPUT
fi
set-jdk:
runs-on: ubuntu-latest
outputs:
jdk: ${{ steps.set-jdk.outputs.jdk }}
steps:
- name: Set JDK based on branch
id: set-jdk
run: |
shopt -s nocasematch
if [[ "${{ github.ref_name }}" == "2025" ]]; then
echo "jdk=17" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "2024" ]]; then
echo "jdk=17" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "2023" ]]; then
echo "jdk=17" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "2022" ]]; then
echo "jdk=17" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "2021" ]]; then
echo "jdk=8" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "2020" ]]; then
echo "jdk=8" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "hoxton" ]]; then
echo "jdk=8" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "greenwich" ]]; then
echo "jdk=8" >> $GITHUB_OUTPUT
else
echo "jdk=17" >> $GITHUB_OUTPUT
fi
shopt -u nocasematch
snapshot:
runs-on: ubuntu-latest
needs: [ check-snapshot, set-jdk ]
if: ${{ needs.check-snapshot.outputs.IS_SNAPSHOT == 'true' }}
steps:
- name: Checkout codes
uses: actions/checkout@v6
- name: Set up JDK ${{ needs.set-jdk.outputs.jdk }}
uses: actions/setup-java@v5
with:
java-version: ${{ needs.set-jdk.outputs.jdk }}
distribution: 'temurin'
server-id: central-portal
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
run: mvn clean deploy -B -U -Dmaven.test.skip=true
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}