-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (45 loc) · 1.41 KB
/
main.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
name: CI/CD
on:
pull_request:
branches: main
types: [opened, synchronize, reopened]
push:
branches: main
paths-ignore: [ "README.md", "doc/**" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin' #Eclipse Temurin
- uses: oneteme/automation-scripts/.github/actions/sonar-java-scan@main
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Extract project version
id: mvnVer
run: echo "version=$(mvn help:evaluate -DforceStdout -Dexpression=project.version -q)" >>$GITHUB_OUTPUT
outputs:
version: ${{ steps.mvnVer.outputs.version }}
deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref_name == 'main' && endsWith(needs.build.outputs.version, '-SNAPSHOT')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin' #Eclipse Temurin
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: mvn --batch-mode --no-transfer-progress deploy