-
-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (89 loc) · 4.02 KB
/
maven-cd.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
# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins
name: maven-cd
on:
workflow_call:
inputs:
validate_only:
type: string
required: false
description: |
Validate with release drafter only
=> Skip release job
default: false
secrets:
MAVEN_USERNAME:
required: true
description: Maven username used for deploying the plugin jar to Jenkins Artifactory Repository
MAVEN_TOKEN:
required: true
description: Maven token used for deploying the plugin jar to Jenkins Artifactory Repository
jobs:
validate:
runs-on: ubuntu-latest
outputs:
# If this is being changed, then align step log-should_release-details below!
should_release: ${{ inputs.validate_only == 'false' && steps.verify-ci-status.outputs.result == 'success' && steps.interesting-categories.outputs.interesting == 'true' }}
steps:
- name: Verify CI status
uses: jenkins-infra/verify-ci-status-action@v1.2.2
id: verify-ci-status
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
output_result: true
- name: Release Drafter
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6
id: draft
if: steps.verify-ci-status.outputs.result == 'success'
with:
name: next
tag: next
version: next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check interesting categories
uses: jenkins-infra/interesting-category-action@v1.2.1
id: interesting-categories
if: steps.verify-ci-status.outputs.result == 'success'
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_DRAFT_BODY: ${{ steps.draft.outputs.body }}
- name: Log should_release details
id: log-should_release-details
run: |
echo "## Job Filter Summary" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "================================" | tee -a $GITHUB_STEP_SUMMARY
echo "Release job filter details:" | tee -a $GITHUB_STEP_SUMMARY
echo " VALIDATE_ONLY: ${VALIDATE_ONLY}" | tee -a $GITHUB_STEP_SUMMARY
echo " CI_STATUS: ${CI_STATUS}" | tee -a $GITHUB_STEP_SUMMARY
echo " INTERESTING_CATEGORY: ${INTERESTING_CATEGORY}" | tee -a $GITHUB_STEP_SUMMARY
echo "--------------------------------" | tee -a $GITHUB_STEP_SUMMARY
echo "=> SHOULD_RELEASE: ${SHOULD_RELEASE}" | tee -a $GITHUB_STEP_SUMMARY
echo "================================" | tee -a $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
env:
VALIDATE_ONLY: ${{ inputs.validate_only }}
CI_STATUS: ${{ steps.verify-ci-status.outputs.result }}
INTERESTING_CATEGORY: ${{ steps.interesting-categories.outputs.interesting }}
# This must be equal to output should_release of job validate above!
SHOULD_RELEASE: ${{ inputs.validate_only == 'false' && steps.verify-ci-status.outputs.result == 'success' && steps.interesting-categories.outputs.interesting == 'true' }}
release:
runs-on: ubuntu-latest
needs: [validate]
if: needs.validate.outputs.should_release == 'true'
steps:
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Release
uses: jenkins-infra/jenkins-maven-cd-action@v1.3.3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}