Skip to content

Commit 4c2463a

Browse files
committed
[CI] Sign task/batch3 apps and deploy to libs-release-local
Signed-off-by: onobc <[email protected]>
1 parent 0f5b401 commit 4c2463a

File tree

5 files changed

+216
-5
lines changed

5 files changed

+216
-5
lines changed

.github/actions/build-sample-app/action.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ inputs:
5454
description: 'Java Version. Default is 8'
5555
required: false
5656
default: '8'
57+
gpg-passphrase:
58+
description: 'The passphrase of the gpg key to sign the artifacts with'
59+
required: false
60+
gpg-private-key:
61+
description: 'The gpg private key to sign the artifacts with'
62+
required: false
63+
5764
runs:
5865
using: "composite"
5966
steps:
@@ -72,7 +79,15 @@ runs:
7279

7380
- name: Maven build
7481
shell: bash
75-
run: ./mvnw ${{ inputs.mvn-build-commands }}
82+
env:
83+
MAVEN_GPG_PRIVATE_KEY: ${{ inputs.gpg-private-key }}
84+
MAVEN_GPG_PASSPHRASE: ${{ inputs.gpg-passphrase }}
85+
run: |
86+
if [ -n "$variable_name" ]; then
87+
echo "${MAVEN_GPG_PRIVATE_KEY}" > private.asc
88+
gpg --import --batch --no-tty private.asc
89+
fi
90+
./mvnw ${{ inputs.mvn-build-commands }}
7691
working-directory: ${{ inputs.app-dir }}
7792

7893
- uses: ./.github/actions/build-sample-app/artifactory-publish
@@ -84,6 +99,8 @@ runs:
8499
jf-mvn-build-commands: ${{ inputs.jf-mvn-build-commands }}
85100
artifactory-repo-deploy-snapshots: ${{ inputs.artifactory-repo-deploy-snapshots }}
86101
artifactory-repo-deploy-releases: ${{ inputs.artifactory-repo-deploy-releases }}
102+
gpg-passphrase: ${{ inputs.gpg-passphrase }}
103+
gpg-private-key: ${{ inputs.gpg-private-key }}
87104

88105
- uses: ./.github/actions/build-sample-app/docker-push
89106
if: ${{ inputs.docker-push == 'true' }}

.github/actions/build-sample-app/artifactory-publish/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ inputs:
2222
description: 'which Artifactory repo to publish non-snapshot versions to (the \"--repo-deploy-releases\" arg passed to \"jfrog rt mvn\")'
2323
required: false
2424
default: 'libs-milestone-local'
25+
gpg-passphrase:
26+
description: 'The passphrase of the gpg key to sign the artifacts with'
27+
required: false
28+
gpg-private-key:
29+
description: 'The gpg private key to sign the artifacts with'
30+
required: false
31+
2532
runs:
2633
using: "composite"
2734
steps:
@@ -45,9 +52,22 @@ runs:
4552
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
4653
working-directory: ${{ inputs.app-dir }}
4754

55+
- name: Print Build Info
56+
shell: bash
57+
run: |
58+
echo "::notice ::JFROG_CLI_BUILD_NAME=$JFROG_CLI_BUILD_NAME"
59+
echo "::notice ::JFROG_CLI_BUILD_NUMBER=$JFROG_CLI_BUILD_NUMBER"
60+
4861
- name: Publish to Artifactory
4962
shell: bash
63+
env:
64+
MAVEN_GPG_PRIVATE_KEY: ${{ inputs.gpg-private-key }}
65+
MAVEN_GPG_PASSPHRASE: ${{ inputs.gpg-passphrase }}
5066
run: |
67+
if [ -n "$variable_name" ]; then
68+
echo "${MAVEN_GPG_PRIVATE_KEY}" > private.asc
69+
gpg --import --batch --no-tty private.asc
70+
fi
5171
jfrog mvn ${{ inputs.jf-mvn-build-commands }}
5272
jfrog rt build-publish
5373
echo "::info ::published ${{ inputs.app-dir }}"

.github/workflows/ci-task-3.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,19 @@ jobs:
4848
- uses: ./.github/actions/build-sample-app
4949
with:
5050
app-dir: 'timestamp-task-3'
51-
mvn-build-commands: '-B clean install spring-boot:build-image'
51+
mvn-build-commands: '-B -Pstagingrelease clean install spring-boot:build-image'
52+
jf-mvn-build-commands: '-B -Pstagingrelease clean install'
5253
artifactory-publish: ${{ inputs.maven-build-only != true }}
5354
jf-server-id: ${{ vars.JF_SERVER_ID }}
5455
jf-artifactory-spring: ${{ secrets.JF_ARTIFACTORY_SPRING }}
55-
artifactory-repo-deploy-releases: 'libs-milestone-local'
56+
artifactory-repo-deploy-releases: 'libs-release-local'
5657
docker-push: ${{ inputs.maven-build-only != true }}
5758
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
5859
docker-password: ${{ secrets.DOCKERHUB_TOKEN }}
5960
java-version: '17'
6061
docker-images: springcloudtask/timestamp-task:${{steps.buildversion.outputs.BUILD_VERSION}}
62+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
63+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
6164

6265
timestamp-batch-3:
6366
runs-on: ubuntu-latest
@@ -74,16 +77,19 @@ jobs:
7477
- uses: ./.github/actions/build-sample-app
7578
with:
7679
app-dir: 'timestamp-batch-3'
77-
mvn-build-commands: '-B clean install spring-boot:build-image'
80+
mvn-build-commands: '-B -Pstagingrelease clean install spring-boot:build-image'
81+
jf-mvn-build-commands: '-B -Pstagingrelease clean install'
7882
artifactory-publish: ${{ inputs.maven-build-only != true }}
7983
jf-server-id: ${{ vars.JF_SERVER_ID }}
8084
jf-artifactory-spring: ${{ secrets.JF_ARTIFACTORY_SPRING }}
81-
artifactory-repo-deploy-releases: 'libs-milestone-local'
85+
artifactory-repo-deploy-releases: 'libs-release-local'
8286
docker-push: ${{ inputs.maven-build-only != true }}
8387
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
8488
docker-password: ${{ secrets.DOCKERHUB_TOKEN }}
8589
java-version: '17'
8690
docker-images: springcloudtask/timestamp-batch-task:${{steps.buildversion.outputs.BUILD_VERSION}}
91+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
92+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
8793

8894
completed:
8995
runs-on: ubuntu-latest

timestamp-batch-3/pom.xml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,88 @@
110110
</plugins>
111111
</build>
112112

113+
<distributionManagement>
114+
<repository>
115+
<id>repo.spring.io</id>
116+
<name>Spring Release Repository</name>
117+
<url>https://repo.spring.io/libs-release-local</url>
118+
</repository>
119+
<snapshotRepository>
120+
<id>repo.spring.io</id>
121+
<name>Spring Snapshot Repository</name>
122+
<url>https://repo.spring.io/libs-snapshot-local</url>
123+
</snapshotRepository>
124+
</distributionManagement>
125+
126+
<repositories>
127+
<repository>
128+
<id>spring-milestones</id>
129+
<name>Spring Milestones</name>
130+
<url>https://repo.spring.io/milestone</url>
131+
</repository>
132+
<repository>
133+
<id>spring-snapshots</id>
134+
<name>Spring Snapshots</name>
135+
<url>https://repo.spring.io/snapshot</url>
136+
<snapshots>
137+
<enabled>true</enabled>
138+
</snapshots>
139+
</repository>
140+
</repositories>
141+
142+
<pluginRepositories>
143+
<pluginRepository>
144+
<id>spring-milestones</id>
145+
<name>Spring Milestones</name>
146+
<url>https://repo.spring.io/milestone</url>
147+
</pluginRepository>
148+
<pluginRepository>
149+
<id>spring-snapshots</id>
150+
<name>Spring Snapshots</name>
151+
<url>https://repo.spring.io/snapshot</url>
152+
<snapshots>
153+
<enabled>true</enabled>
154+
</snapshots>
155+
</pluginRepository>
156+
</pluginRepositories>
157+
158+
<profiles>
159+
<profile>
160+
<id>milestone</id>
161+
<distributionManagement>
162+
<repository>
163+
<id>repo.spring.io</id>
164+
<name>Spring Milestone Repository</name>
165+
<url>https://repo.spring.io/libs-milestone-local</url>
166+
</repository>
167+
</distributionManagement>
168+
</profile>
169+
<profile>
170+
<id>stagingrelease</id>
171+
<build>
172+
<plugins>
173+
<plugin>
174+
<artifactId>maven-gpg-plugin</artifactId>
175+
<version>3.2.8</version>
176+
<executions>
177+
<execution>
178+
<id>sign-artifacts</id>
179+
<phase>verify</phase>
180+
<goals>
181+
<goal>sign</goal>
182+
</goals>
183+
</execution>
184+
</executions>
185+
<configuration>
186+
<gpgArguments>
187+
<arg>--batch</arg>
188+
<arg>--pinentry-mode=loopback</arg>
189+
</gpgArguments>
190+
</configuration>
191+
</plugin>
192+
</plugins>
193+
</build>
194+
</profile>
195+
</profiles>
196+
113197
</project>

timestamp-task-3/pom.xml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,88 @@
9797
</plugins>
9898
</build>
9999

100+
<distributionManagement>
101+
<repository>
102+
<id>repo.spring.io</id>
103+
<name>Spring Release Repository</name>
104+
<url>https://repo.spring.io/libs-release-local</url>
105+
</repository>
106+
<snapshotRepository>
107+
<id>repo.spring.io</id>
108+
<name>Spring Snapshot Repository</name>
109+
<url>https://repo.spring.io/libs-snapshot-local</url>
110+
</snapshotRepository>
111+
</distributionManagement>
112+
113+
<repositories>
114+
<repository>
115+
<id>spring-milestones</id>
116+
<name>Spring Milestones</name>
117+
<url>https://repo.spring.io/milestone</url>
118+
</repository>
119+
<repository>
120+
<id>spring-snapshots</id>
121+
<name>Spring Snapshots</name>
122+
<url>https://repo.spring.io/snapshot</url>
123+
<snapshots>
124+
<enabled>true</enabled>
125+
</snapshots>
126+
</repository>
127+
</repositories>
128+
129+
<pluginRepositories>
130+
<pluginRepository>
131+
<id>spring-milestones</id>
132+
<name>Spring Milestones</name>
133+
<url>https://repo.spring.io/milestone</url>
134+
</pluginRepository>
135+
<pluginRepository>
136+
<id>spring-snapshots</id>
137+
<name>Spring Snapshots</name>
138+
<url>https://repo.spring.io/snapshot</url>
139+
<snapshots>
140+
<enabled>true</enabled>
141+
</snapshots>
142+
</pluginRepository>
143+
</pluginRepositories>
144+
145+
<profiles>
146+
<profile>
147+
<id>milestone</id>
148+
<distributionManagement>
149+
<repository>
150+
<id>repo.spring.io</id>
151+
<name>Spring Milestone Repository</name>
152+
<url>https://repo.spring.io/libs-milestone-local</url>
153+
</repository>
154+
</distributionManagement>
155+
</profile>
156+
<profile>
157+
<id>stagingrelease</id>
158+
<build>
159+
<plugins>
160+
<plugin>
161+
<artifactId>maven-gpg-plugin</artifactId>
162+
<version>3.2.8</version>
163+
<executions>
164+
<execution>
165+
<id>sign-artifacts</id>
166+
<phase>verify</phase>
167+
<goals>
168+
<goal>sign</goal>
169+
</goals>
170+
</execution>
171+
</executions>
172+
<configuration>
173+
<gpgArguments>
174+
<arg>--batch</arg>
175+
<arg>--pinentry-mode=loopback</arg>
176+
</gpgArguments>
177+
</configuration>
178+
</plugin>
179+
</plugins>
180+
</build>
181+
</profile>
182+
</profiles>
183+
100184
</project>

0 commit comments

Comments
 (0)