Change the way of release workflow (#1434)
* use version placeholders in pom.xml files * add release drafter config and workflow * update master workflow * update release workflow * update branch-deploy.yml workflow Co-authored-by: Roman Zabaluev <rzabaluev@provectus.com>
This commit is contained in:
parent
45b9a10c7c
commit
79442a7e82
9 changed files with 90 additions and 90 deletions
35
.github/release_drafter.yaml
vendored
Normal file
35
.github/release_drafter.yaml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
name-template: 'v$RESOLVED_VERSION'
|
||||||
|
tag-template: '$RESOLVED_VERSION'
|
||||||
|
template: |
|
||||||
|
## Changes
|
||||||
|
$CHANGES
|
||||||
|
## Contributors
|
||||||
|
$CONTRIBUTORS
|
||||||
|
|
||||||
|
exclude-labels:
|
||||||
|
- 'skip-changelog'
|
||||||
|
|
||||||
|
categories:
|
||||||
|
- title: '⚙️Features'
|
||||||
|
labels:
|
||||||
|
- 'type/feature'
|
||||||
|
- title: '🪛Enhancements'
|
||||||
|
labels:
|
||||||
|
- 'type/enhancement'
|
||||||
|
- title: '🔨Bug Fixes'
|
||||||
|
labels:
|
||||||
|
- 'type/bug'
|
||||||
|
|
||||||
|
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
|
||||||
|
|
||||||
|
version-resolver:
|
||||||
|
major:
|
||||||
|
labels:
|
||||||
|
- 'major'
|
||||||
|
minor:
|
||||||
|
labels:
|
||||||
|
- 'minor'
|
||||||
|
patch:
|
||||||
|
labels:
|
||||||
|
- 'patch'
|
||||||
|
default: patch
|
4
.github/workflows/branch-deploy.yml
vendored
4
.github/workflows/branch-deploy.yml
vendored
|
@ -35,9 +35,9 @@ jobs:
|
||||||
- name: Build
|
- name: Build
|
||||||
id: build
|
id: build
|
||||||
run: |
|
run: |
|
||||||
export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
mvn clean package -Pprod -DskipTests -DbuildVersion=$GITHUB_SHA
|
||||||
|
export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' -DbuildVersion=$GITHUB_SHA --non-recursive exec:exec)
|
||||||
echo "::set-output name=version::${VERSION}"
|
echo "::set-output name=version::${VERSION}"
|
||||||
mvn clean package -Pprod -DskipTests
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
|
|
13
.github/workflows/master.yaml
vendored
13
.github/workflows/master.yaml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: latest
|
name: Master
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
|
@ -9,6 +9,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Cache local Maven repository
|
- name: Cache local Maven repository
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -16,16 +17,18 @@ jobs:
|
||||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-maven-
|
${{ runner.os }}-maven-
|
||||||
|
|
||||||
- name: Set up JDK 1.13
|
- name: Set up JDK 1.13
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 1.13
|
java-version: 1.13
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
id: build
|
id: build
|
||||||
run: |
|
run: |
|
||||||
export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
mvn clean package -Pprod -DskipTests -DbuildVersion=$GITHUB_SHA
|
||||||
|
export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' -DbuildVersion=$GITHUB_SHA --non-recursive exec:exec)
|
||||||
echo "::set-output name=version::${VERSION}"
|
echo "::set-output name=version::${VERSION}"
|
||||||
mvn clean package -Pprod -DskipTests
|
|
||||||
#################
|
#################
|
||||||
# #
|
# #
|
||||||
# Docker images #
|
# Docker images #
|
||||||
|
@ -33,8 +36,10 @@ jobs:
|
||||||
#################
|
#################
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
- name: Cache Docker layers
|
- name: Cache Docker layers
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -42,11 +47,13 @@ jobs:
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build_and_push
|
id: docker_build_and_push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
|
|
101
.github/workflows/release.yaml
vendored
101
.github/workflows/release.yaml
vendored
|
@ -1,19 +1,7 @@
|
||||||
name: release
|
name: Release
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
release:
|
||||||
inputs:
|
types: [published]
|
||||||
customVersion:
|
|
||||||
description: 'A new version for release, please provide with -SNAPSHOT suffix'
|
|
||||||
required: false
|
|
||||||
default: '0.0.0'
|
|
||||||
rebuild:
|
|
||||||
description: 'A tag name for building previously created release'
|
|
||||||
required: false
|
|
||||||
default: 'v0.0.0'
|
|
||||||
extraMavenOptions:
|
|
||||||
description: 'A extra options for Maven'
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
|
@ -24,9 +12,11 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
git config user.name github-actions
|
git config user.name github-actions
|
||||||
git config user.email github-actions@github.com
|
git config user.email github-actions@github.com
|
||||||
|
|
||||||
- name: Cache local Maven repository
|
- name: Cache local Maven repository
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -34,43 +24,19 @@ jobs:
|
||||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-maven-
|
${{ runner.os }}-maven-
|
||||||
|
|
||||||
- name: Set up JDK 1.13
|
- name: Set up JDK 1.13
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 1.13
|
java-version: 1.13
|
||||||
- name: Checkout to specific tag
|
|
||||||
if: github.event.inputs.rebuild != 'v0.0.0'
|
|
||||||
run: |
|
|
||||||
git checkout tags/${{ github.event.inputs.rebuild }} -b rebuild-${{ github.event.inputs.rebuild }}
|
|
||||||
- name: Set custom version
|
|
||||||
if: github.event.inputs.customVersion != '0.0.0' && github.event.inputs.rebuild == 'v0.0.0'
|
|
||||||
run: |
|
|
||||||
mvn -q versions:set -DnewVersion=${{ github.event.inputs.customVersion }}
|
|
||||||
git add pom.xml **/pom.xml
|
|
||||||
git commit -m "Increased release"
|
|
||||||
- name: Update development version
|
|
||||||
if: github.event.inputs.rebuild == 'v0.0.0'
|
|
||||||
run: |
|
|
||||||
mvn -q versions:set -DnextSnapshot
|
|
||||||
git add pom.xml **/pom.xml
|
|
||||||
git commit -m "Increased version in pom.xml"
|
|
||||||
git push -f
|
|
||||||
git reset --hard HEAD~1
|
|
||||||
- name: Prepare release
|
|
||||||
if: github.event.inputs.rebuild == 'v0.0.0'
|
|
||||||
run: |
|
|
||||||
mvn -q versions:set -DremoveSnapshot
|
|
||||||
export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
|
||||||
git add .
|
|
||||||
git commit -m "release ${VERSION}"
|
|
||||||
git tag -f v${VERSION}
|
|
||||||
git push --tags
|
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
id: build
|
id: build
|
||||||
run: |
|
run: |
|
||||||
mvn clean package -Pprod ${{ github.event.inputs.extraMavenOptions }}
|
mvn clean package -Pprod -DskipTests -DbuildVersion=${{ github.event.release.tag_name }}
|
||||||
export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' -DbuildVersion=${{ github.event.release.tag_name }} --non-recursive exec:exec)
|
||||||
echo ::set-output name=version::${VERSION}
|
echo ::set-output name=version::${VERSION}
|
||||||
|
|
||||||
- name: Archive JAR
|
- name: Archive JAR
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
@ -83,8 +49,10 @@ jobs:
|
||||||
#################
|
#################
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
- name: Cache Docker layers
|
- name: Cache Docker layers
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -92,12 +60,14 @@ jobs:
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build_and_push
|
id: docker_build_and_push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
|
@ -113,6 +83,7 @@ jobs:
|
||||||
JAR_FILE=kafka-ui-api-${{ steps.build.outputs.version }}.jar
|
JAR_FILE=kafka-ui-api-${{ steps.build.outputs.version }}.jar
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
charts:
|
charts:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: release
|
needs: release
|
||||||
|
@ -120,14 +91,18 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
git config user.name github-actions
|
git config user.name github-actions
|
||||||
git config user.email github-actions@github.com
|
git config user.email github-actions@github.com
|
||||||
|
|
||||||
- uses: azure/setup-helm@v1
|
- uses: azure/setup-helm@v1
|
||||||
|
|
||||||
- name: update appVersion
|
- name: update appVersion
|
||||||
run: |
|
run: |
|
||||||
export version=${{needs.release.outputs.version}}
|
export version=${{needs.release.outputs.version}}
|
||||||
sed -i "s/appVersion:.*/appVersion: ${version}/" charts/kafka-ui/Chart.yaml
|
sed -i "s/appVersion:.*/appVersion: ${version}/" charts/kafka-ui/Chart.yaml
|
||||||
|
|
||||||
- name: add chart
|
- name: add chart
|
||||||
run: |
|
run: |
|
||||||
export VERSION=${{needs.release.outputs.version}}
|
export VERSION=${{needs.release.outputs.version}}
|
||||||
|
@ -139,39 +114,3 @@ jobs:
|
||||||
git add -f ${MSG##*/} index.yaml
|
git add -f ${MSG##*/} index.yaml
|
||||||
git commit -m "release ${VERSION}"
|
git commit -m "release ${VERSION}"
|
||||||
git push
|
git push
|
||||||
gh-release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: release
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- run: |
|
|
||||||
git config user.name github-actions
|
|
||||||
git config user.email github-actions@github.com
|
|
||||||
- id: generate
|
|
||||||
shell: /usr/bin/bash -x -e {0}
|
|
||||||
run: |
|
|
||||||
VERSION=${{needs.release.outputs.version}}
|
|
||||||
CHANGELOG=$(git --no-pager log --oneline --pretty=format:"- %s" `git tag --sort=-creatordate | grep '^v.*' | head -n2 | tail -n1`.. | uniq | grep -v '^- Merge\|^- skip')
|
|
||||||
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
|
||||||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
|
||||||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
|
|
||||||
echo ${CHANGELOG}
|
|
||||||
echo "::set-output name=changelog::${CHANGELOG}"
|
|
||||||
- name: Download release JAR
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: kafka-ui-${{needs.release.outputs.version}}
|
|
||||||
path: .
|
|
||||||
- id: create_release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
name: ${{needs.release.outputs.version}}
|
|
||||||
draft: false
|
|
||||||
tag_name: "v${{needs.release.outputs.version}}"
|
|
||||||
prerelease: false
|
|
||||||
files: kafka-ui-api-${{needs.release.outputs.version}}.jar
|
|
||||||
body: ${{steps.generate.outputs.changelog}}
|
|
||||||
|
|
18
.github/workflows/release_drafter.yml
vendored
Normal file
18
.github/workflows/release_drafter.yml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
name: Release Drafter
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# branches to consider in the event; optional, defaults to all
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update_release_draft:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: release-drafter/release-drafter@v5
|
||||||
|
with:
|
||||||
|
config-name: release_drafter.yaml
|
||||||
|
disable-autolabeler: true
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>kafka-ui</artifactId>
|
<artifactId>kafka-ui</artifactId>
|
||||||
<groupId>com.provectus</groupId>
|
<groupId>com.provectus</groupId>
|
||||||
<version>0.3.3-SNAPSHOT</version>
|
<version>${buildVersion}</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>kafka-ui</artifactId>
|
<artifactId>kafka-ui</artifactId>
|
||||||
<groupId>com.provectus</groupId>
|
<groupId>com.provectus</groupId>
|
||||||
<version>0.3.3-SNAPSHOT</version>
|
<version>${buildVersion}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>kafka-ui</artifactId>
|
<artifactId>kafka-ui</artifactId>
|
||||||
<groupId>com.provectus</groupId>
|
<groupId>com.provectus</groupId>
|
||||||
<version>0.3.3-SNAPSHOT</version>
|
<version>${buildVersion}</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
3
pom.xml
3
pom.xml
|
@ -45,6 +45,7 @@
|
||||||
</frontend-generated-sources-directory>
|
</frontend-generated-sources-directory>
|
||||||
<sonar.organization>provectus</sonar.organization>
|
<sonar.organization>provectus</sonar.organization>
|
||||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||||
|
<buildVersion>0.0.1-SNAPSHOT</buildVersion>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
@ -84,7 +85,7 @@
|
||||||
|
|
||||||
<groupId>com.provectus</groupId>
|
<groupId>com.provectus</groupId>
|
||||||
<artifactId>kafka-ui</artifactId>
|
<artifactId>kafka-ui</artifactId>
|
||||||
<version>0.3.3-SNAPSHOT</version>
|
<version>${buildVersion}</version>
|
||||||
<name>kafka-ui</name>
|
<name>kafka-ui</name>
|
||||||
<description>Kafka metrics for UI panel</description>
|
<description>Kafka metrics for UI panel</description>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Add table
Reference in a new issue