1- name : release
2- on :
3- workflow_dispatch :
4- inputs :
5- customVersion :
6- description : ' A new version for release, please provide with -SNAPSHOT suffix'
7- required : false
8- default : ' 0.0.0'
9- rebuild :
10- description : ' A tag name for building previously created release'
11- required : false
12- default : ' v0.0.0'
13- extraMavenOptions :
14- description : ' A extra options for Maven'
15- required : false
16- default : ' '
1+ name : Release
2+ on :
3+ release :
4+ types : [published]
175
186jobs :
197 release :
@@ -24,53 +12,31 @@ jobs:
2412 - uses : actions/checkout@v2
2513 with :
2614 fetch-depth : 0
15+
2716 - run : |
2817 git config user.name github-actions
2918 git config user.email [email protected] 19+
3020 - name : Cache local Maven repository
3121 uses : actions/cache@v2
3222 with :
3323 path : ~/.m2/repository
3424 key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
3525 restore-keys : |
3626 ${{ runner.os }}-maven-
27+
3728 - name : Set up JDK 1.13
3829 uses : actions/setup-java@v1
3930 with :
4031 java-version : 1.13
41- - name : Checkout to specific tag
42- if : github.event.inputs.rebuild != 'v0.0.0'
43- run : |
44- git checkout tags/${{ github.event.inputs.rebuild }} -b rebuild-${{ github.event.inputs.rebuild }}
45- - name : Set custom version
46- if : github.event.inputs.customVersion != '0.0.0' && github.event.inputs.rebuild == 'v0.0.0'
47- run : |
48- mvn -q versions:set -DnewVersion=${{ github.event.inputs.customVersion }}
49- git add pom.xml **/pom.xml
50- git commit -m "Increased release"
51- - name : Update development version
52- if : github.event.inputs.rebuild == 'v0.0.0'
53- run : |
54- mvn -q versions:set -DnextSnapshot
55- git add pom.xml **/pom.xml
56- git commit -m "Increased version in pom.xml"
57- git push -f
58- git reset --hard HEAD~1
59- - name : Prepare release
60- if : github.event.inputs.rebuild == 'v0.0.0'
61- run : |
62- mvn -q versions:set -DremoveSnapshot
63- export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
64- git add .
65- git commit -m "release ${VERSION}"
66- git tag -f v${VERSION}
67- git push --tags
32+
6833 - name : Build with Maven
6934 id : build
7035 run : |
71- mvn clean package -Pprod ${{ github.event.inputs.extraMavenOptions }}
72- export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
36+ mvn clean package -Pprod -DskipTests -DbuildVersion= ${{ github.event.release.tag_name }}
37+ export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' -DbuildVersion=${{ github.event.release.tag_name }} - -non-recursive exec:exec)
7338 echo ::set-output name=version::${VERSION}
39+
7440 - name : Archive JAR
7541 uses : actions/upload-artifact@v2
7642 with :
@@ -83,21 +49,25 @@ jobs:
8349# ################
8450 - name : Set up QEMU
8551 uses : docker/setup-qemu-action@v1
52+
8653 - name : Set up Docker Buildx
8754 uses : docker/setup-buildx-action@v1
55+
8856 - name : Cache Docker layers
8957 uses : actions/cache@v2
9058 with :
9159 path : /tmp/.buildx-cache
9260 key : ${{ runner.os }}-buildx-${{ github.sha }}
9361 restore-keys : |
9462 ${{ runner.os }}-buildx-
63+
9564 - name : Login to DockerHub
9665 if : github.ref == 'refs/heads/master'
9766 uses : docker/login-action@v1
9867 with :
9968 username : ${{ secrets.DOCKERHUB_USERNAME }}
10069 password : ${{ secrets.DOCKERHUB_TOKEN }}
70+
10171 - name : Build and push
10272 id : docker_build_and_push
10373 uses : docker/build-push-action@v2
@@ -113,21 +83,26 @@ jobs:
11383 JAR_FILE=kafka-ui-api-${{ steps.build.outputs.version }}.jar
11484 cache-from : type=local,src=/tmp/.buildx-cache
11585 cache-to : type=local,dest=/tmp/.buildx-cache
86+
11687 charts :
11788 runs-on : ubuntu-latest
11889 needs : release
11990 steps :
12091 - uses : actions/checkout@v2
12192 with :
12293 fetch-depth : 1
94+
12395 - run : |
12496 git config user.name github-actions
12597 git config user.email [email protected] 98+
12699 - uses : azure/setup-helm@v1
100+
127101 - name : update appVersion
128102 run : |
129103 export version=${{needs.release.outputs.version}}
130104 sed -i "s/appVersion:.*/appVersion: ${version}/" charts/kafka-ui/Chart.yaml
105+
131106 - name : add chart
132107 run : |
133108 export VERSION=${{needs.release.outputs.version}}
@@ -139,39 +114,3 @@ jobs:
139114 git add -f ${MSG##*/} index.yaml
140115 git commit -m "release ${VERSION}"
141116 git push
142- gh-release :
143- runs-on : ubuntu-latest
144- needs : release
145- steps :
146- - uses : actions/checkout@v2
147- with :
148- fetch-depth : 0
149- - run : |
150- git config user.name github-actions
151- git config user.email [email protected] 152- - id : generate
153- shell : /usr/bin/bash -x -e {0}
154- run : |
155- VERSION=${{needs.release.outputs.version}}
156- CHANGELOG=$(git --no-pager log --oneline --pretty=format:"- %s" `git tag --sort=-creatordate | grep '^v.*' | head -n2 | tail -n1`.. | uniq | grep -v '^- Merge\|^- skip')
157- CHANGELOG="${CHANGELOG//'%'/'%25'}"
158- CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
159- CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
160- echo ${CHANGELOG}
161- echo "::set-output name=changelog::${CHANGELOG}"
162- - name : Download release JAR
163- uses : actions/download-artifact@v2
164- with :
165- name : kafka-ui-${{needs.release.outputs.version}}
166- path : .
167- - id : create_release
168- uses : softprops/action-gh-release@v1
169- env :
170- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
171- with :
172- name : ${{needs.release.outputs.version}}
173- draft : false
174- tag_name : " v${{needs.release.outputs.version}}"
175- prerelease : false
176- files : kafka-ui-api-${{needs.release.outputs.version}}.jar
177- body : ${{steps.generate.outputs.changelog}}
0 commit comments