-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (93 loc) · 3.26 KB
/
spring-artifactory-maven-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
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
102
103
104
105
106
107
108
name: CI Artifactory SNAPSHOT Build for Maven
on:
workflow_call:
inputs:
mavenArgs:
description: 'Additional mvn command arguments: goals, plugins etc. The `deploy` is included.'
required: false
type: string
artifactoryUrl:
description: 'The Artifactory Server'
required: false
type: string
default: https://repo.spring.io
targetRepository:
description: 'The Artifactory Repository to upload snapshot artifacts to'
required: false
type: string
default: libs-snapshot-local
artifactoryProjectKey:
description: 'The Artifactory project key'
required: false
type: string
runner:
description: 'The runner for job'
required: false
type: string
default: ubuntu-latest
secrets:
ARTIFACTORY_USERNAME:
required: true
ARTIFACTORY_PASSWORD:
required: true
DEVELOCITY_ACCESS_KEY:
required: false
GPG_PRIVATE_KEY:
required: false
GPG_PASSPHRASE:
required: false
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
jobs:
build_snapshot:
runs-on: ${{ inputs.runner }}
name: CI Build SNAPSHOT for ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Build and Deploy
run: ./mvnw -B -ntp -DaltDeploymentRepository=local::file:deployment-repository ${{ inputs.mavenArgs }} deploy
- name: Evaluate Build Name
id: build-name
run: |
echo Evaluate Build Name
branchVersion=${{ github.ref_name }}
if [ $branchVersion = 'main' ]; then
snapshotVersion=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
branchVersion=${snapshotVersion%.*}.x
fi
buildName=${{ github.event.repository.name }}-$branchVersion
buildNumber=${{ github.run_number }}
echo buildName=$buildName >> $GITHUB_OUTPUT
echo "::notice title=Artifactory Build Name & Number::$buildName/$buildNumber"
- name: Publish
uses: spring-io/[email protected]
with:
uri: ${{ inputs.artifactoryUrl }}
project: ${{ inputs.artifactoryProjectKey }}
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
build-name: ${{ steps.build-name.outputs.buildName }}
repository: ${{ inputs.targetRepository }}
folder: deployment-repository
artifact-properties: |
/**/*.zip::zip.name=${{ github.event.repository.name }},zip.deployed=false
/**/*docs.zip::zip.type=docs
/**/*dist.zip::zip.type=dist
threads: 10
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Capture Test Results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results
path: '**/target/surefire-reports/*.*'
retention-days: 3