-
Notifications
You must be signed in to change notification settings - Fork 31
85 lines (76 loc) · 2.57 KB
/
cd.yaml
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
---
name: cd
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v3.1.0
with:
distribution: 'temurin'
java-version: 8
- name: Cache maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Wait for build to succeed
uses: fountainhead/action-wait-for-check@v1.0.0
id: wait-for-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: Jenkins
- name: next release version
id: nextversion
uses: jenkins-x-plugins/jx-release-version@v2.5.1
- name: Set Version
run: |
mvn --no-transfer-progress versions:set -DnewVersion=${{ steps.nextversion.outputs.version }}
- name: Release Drafter
uses: release-drafter/release-drafter@v5.19.0
if: steps.wait-for-build.outputs.conclusion == 'success'
with:
name: next
tag: next
version: next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Interesting
id: interesting
if: steps.wait-for-build.outputs.conclusion == 'success'
run: |
set -euxo pipefail
echo $GITHUB_EVENT_NAME
if [ "${GITHUB_EVENT_NAME}" = "push" ]
then
INTERESTING_CATEGORIES='[💥🚨🎉🐛⚠🚀👷]|:(boom|tada|construction_worker):'
CATEGORIES=$(gh api /repos/$GITHUB_REPOSITORY/releases | jq -e -r '.[] | select(.draft == true and .name == "next") | .body')
if echo "${CATEGORIES}" | egrep -q "${INTERESTING_CATEGORIES}"; then
echo "Interesting release"
echo "::set-output name=should_release::true"
else
echo "Not interesting release"
echo "::set-output name=should_release::false"
fi
else
echo "::set-output name=should_release::true"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: jenkins-infra/jenkins-maven-cd-action@master
if: steps.interesting.outputs.should_release == 'true'
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }}