Skip to content

Commit fa76df8

Browse files
committed
Add more Maven workflows
* Make Gradle Enterprise secrets as optional (Maven don't need them) * Add `verifyStagedWorkflow` release workflow optional input with a `verify-staged-artifacts.yml` by default * Fix `README.md` for current state of workflows
1 parent d7d2338 commit fa76df8

File tree

4 files changed

+117
-8
lines changed

4 files changed

+117
-8
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CI Artifactory SNAPSHOT Build for Maven
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
mavenArgs:
7+
description: 'Additional mvn command arguments: goals, plugins etc. The `install` is included.'
8+
required: false
9+
type: string
10+
11+
secrets:
12+
JF_ARTIFACTORY_SPRING:
13+
required: true
14+
15+
env:
16+
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
17+
18+
jobs:
19+
build_snapshot:
20+
runs-on: ubuntu-latest
21+
name: CI Build SNAPSHOT for ${{ github.ref_name }}
22+
steps:
23+
24+
- uses: actions/checkout@v3
25+
26+
- name: Set up JDK
27+
uses: actions/setup-java@v3
28+
with:
29+
distribution: adopt
30+
java-version: 17
31+
cache: 'maven'
32+
33+
- uses: jfrog/setup-jfrog-cli@v3
34+
35+
- name: Configure JFrog Cli
36+
run: |
37+
jf mvnc \
38+
--use-wrapper=true \
39+
--repo-resolve-releases=libs-milestone \
40+
--repo-resolve-snapshots=snapshot \
41+
--repo-deploy-releases=libs-milestone-local \
42+
--repo-deploy-snapshots=libs-snapshot-local
43+
echo JFROG_CLI_BUILD_NAME=${{ github.event.repository.name }}-${{ github.ref_name }} >> $GITHUB_ENV
44+
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
45+
46+
- name: Build and Publish
47+
run: |
48+
jf mvn install -B -ntp ${{ inputs.mavenArgs }}
49+
jf rt build-publish
50+
51+
- name: Capture Test Results
52+
if: failure()
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: test-results
56+
path: '**/target/surefire-reports/**/*.*'
57+
retention-days: 3
58+

.github/workflows/spring-artifactory-release.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@ on:
77
description: 'Additional Maven or Gradle command arguments: tasks, goals, plugins etc. The `install` for Maven is included. The `build` and `artifactoryPublish` for Gradle are included.'
88
required: false
99
type: string
10+
verifyStagedWorkflow:
11+
description: 'A workflow name in the target project to dispatch against staged artifacts. The `releaseVersion` must be a workflow input.'
12+
required: false
13+
type: string
14+
default: verify-staged-artifacts.yml
1015

1116
secrets:
12-
GH_ACTIONS_REPO_TOKEN:
13-
required: true
1417
GRADLE_ENTERPRISE_CACHE_USER:
15-
required: true
18+
required: false
1619
GRADLE_ENTERPRISE_CACHE_PASSWORD:
17-
required: true
20+
required: false
1821
GRADLE_ENTERPRISE_SECRET_ACCESS_KEY:
22+
required: false
23+
GH_ACTIONS_REPO_TOKEN:
1924
required: true
2025
OSSRH_URL:
2126
required: true
@@ -87,7 +92,7 @@ jobs:
8792
- name: Call smoke tests workflow
8893
uses: aurelien-baudet/workflow-dispatch@v2
8994
with:
90-
workflow: verify-staged-artifacts.yml
95+
workflow: ${{ inputs.verifyStagedWorkflow }}
9196
wait-for-completion-interval: 30s
9297
display-workflow-run-url-interval: 5s
9398
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Pull Request Build with Maven
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up JDK
16+
uses: actions/setup-java@v3
17+
with:
18+
distribution: adopt
19+
java-version: 17
20+
cache: 'maven'
21+
22+
- name: Build with Maven
23+
run: ./mvnw verify -B -ntp
24+
25+
- name: Capture Test Results
26+
if: failure()
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: test-results
30+
path: '**/target/surefire-reports/**/*.*'
31+
retention-days: 3

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,34 @@ jobs:
1717
uses: artembilan/spring-messaging-build-tools/.github/workflows/spring-artifactory-release.yml@main
1818
with:
1919
buildToolArgs: dist
20-
secrets: inherit
20+
verifyStagedWorkflow: verify-staged-artifacts.yml
21+
secrets:
22+
GH_ACTIONS_REPO_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
23+
GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
24+
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
25+
GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
26+
JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
27+
SPRING_RELEASE_SLACK_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_SLACK_WEBHOOK_URL }}
28+
OSSRH_URL: ${{ secrets.OSSRH_URL }}
29+
OSSRH_S01_TOKEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
30+
OSSRH_S01_TOKEN_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
31+
OSSRH_STAGING_PROFILE_NAME: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
32+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
33+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
2134
```
2235
on every branch which is supposed to be released via GitHub actions.
2336

2437
The `buildToolArgs` parameter for this job means extra build tool arguments.
2538
For example, the mentioned `dist` value is a Gradle task in the project.
2639
Can be any Maven goal or other command line arguments.
2740

41+
The mentioned secrets must be passed explicitly since these reusable workflows might be in different GitHub org than target project.
42+
2843
When a release workflow is dispatched, the `releaseVersion` job determines the milestone to release against the current SNAPSHOT version in the branch.
2944
If no milestone scheduled, the whole workflow is cancelled.
3045
Then `staging` job uses the `releaseVersion` output from the previous `releaseVersion` job and dispatch the work to Gradle or Maven jobs according to the project build tool.
31-
The `verify-staged` requires a `verify-staged-artifacts.yml` workflow present in the project.
32-
For example, [Spring Integation for AWS](https://github.com/spring-projects/spring-integration-aws) use `jfrog rt download` command to verify that released `spring-integration-aws.jar` is valid.
46+
The `verify-staged` expects an optional `verifyStagedWorkflow` input (the `verify-staged-artifacts.yml`, by default) workflow supplied from the target project.
47+
For example, [Spring Integration for AWS](https://github.com/spring-projects/spring-integration-aws) use `jfrog rt download` command to verify that released `spring-integration-aws.jar` is valid.
3348
Other projects may check out their samples repository and setup release version to perform smoke tests against just staged artifacts.
3449

3550
The next job in the workflow is to promote release from staging either to `libs-milestone-local` or `libs-release-local`(and Maven Central) according to the releasing version schema.

0 commit comments

Comments
 (0)