|
1 |
| ---- |
| 1 | +# Note: additional setup is required, see https://www.jenkins.io/redirect/continuous-delivery-of-plugins |
| 2 | + |
2 | 3 | name: cd
|
3 | 4 | on:
|
4 | 5 | workflow_dispatch:
|
5 |
| - push: |
6 |
| - branches: |
7 |
| - - main |
8 |
| - - master |
| 6 | + check_run: |
| 7 | + types: |
| 8 | + - completed |
9 | 9 |
|
10 | 10 | jobs:
|
11 |
| - deploy: |
12 |
| - runs-on: ubuntu-latest |
13 |
| - steps: |
14 |
| - - name: Check out |
15 |
| - uses: actions/checkout@v3 |
16 |
| - with: |
17 |
| - fetch-depth: 0 |
18 |
| - |
19 |
| - - name: Set up JDK 8 |
20 |
| - uses: actions/setup-java@v3 |
21 |
| - with: |
22 |
| - distribution: 'temurin' |
23 |
| - java-version: 8 |
24 |
| - |
25 |
| - - name: Wait for build to succeed |
26 |
| - uses: fountainhead/[email protected] |
27 |
| - id: wait-for-build |
28 |
| - with: |
29 |
| - token: ${{ secrets.GITHUB_TOKEN }} |
30 |
| - checkName: Jenkins |
31 |
| - |
32 |
| - - name: next release version |
33 |
| - id: nextversion |
34 |
| - uses: jenkins-x-plugins/[email protected] |
35 |
| - |
36 |
| - - name: Set Version |
37 |
| - run: | |
38 |
| - mvn --no-transfer-progress versions:set -DnewVersion=${{ steps.nextversion.outputs.version }} |
39 |
| - - name: Release Drafter |
40 |
| - uses: release-drafter/[email protected] |
41 |
| - if: steps.wait-for-build.outputs.conclusion == 'success' |
42 |
| - with: |
43 |
| - name: next |
44 |
| - tag: next |
45 |
| - version: next |
46 |
| - env: |
47 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
48 |
| - |
49 |
| - - name: Interesting |
50 |
| - id: interesting |
51 |
| - if: steps.wait-for-build.outputs.conclusion == 'success' |
52 |
| - run: | |
53 |
| - set -euxo pipefail |
54 |
| - echo $GITHUB_EVENT_NAME |
55 |
| - if [ "${GITHUB_EVENT_NAME}" = "push" ] |
56 |
| - then |
57 |
| - INTERESTING_CATEGORIES='[💥🚨🎉🐛⚠🚀👷]|:(boom|tada|construction_worker):' |
58 |
| - CATEGORIES=$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .body') |
59 |
| - if echo "${CATEGORIES}" | egrep -q "${INTERESTING_CATEGORIES}"; then |
60 |
| - echo "Interesting release" |
61 |
| - echo "should_release=true" >> $GITHUB_OUTPUT |
62 |
| - else |
63 |
| - echo "Not interesting release" |
64 |
| - echo "should_release=false" >> $GITHUB_OUTPUT |
65 |
| - fi |
66 |
| - else |
67 |
| - echo "should_release=true" >> $GITHUB_OUTPUT |
68 |
| - fi |
69 |
| - env: |
70 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
71 |
| - |
72 |
| - - name: Release |
73 |
| - uses: jenkins-infra/jenkins-maven-cd-action@master |
74 |
| - if: steps.interesting.outputs.should_release == 'true' |
75 |
| - with: |
76 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
77 |
| - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} |
78 |
| - MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} |
| 11 | + maven-cd: |
| 12 | + uses: jenkins-infra/github-reusable-workflows/.github/workflows/maven-cd.yml@v1 |
| 13 | + secrets: |
| 14 | + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} |
| 15 | + MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} |
0 commit comments