-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (44 loc) · 1.37 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
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 version
id: prj_ver
uses: oneteme/automation-scripts/.github/actions/mvn-project-version@main
outputs:
version: ${{ steps.prj_ver.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
- uses: oneteme/automation-scripts/.github/actions/mvn-deploy@main
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}