|
@@ -0,0 +1,77 @@
|
|
|
+name: release
|
|
|
+on:
|
|
|
+ workflow_dispatch:
|
|
|
+
|
|
|
+jobs:
|
|
|
+ release:
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+ steps:
|
|
|
+ - uses: actions/checkout@v2
|
|
|
+ - run: |
|
|
|
+ git config user.name github-actions
|
|
|
+ git config user.email github-actions@github.com
|
|
|
+ - name: Cache local Maven repository
|
|
|
+ uses: actions/cache@v2
|
|
|
+ with:
|
|
|
+ path: ~/.m2/repository
|
|
|
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
|
|
+ restore-keys: |
|
|
|
+ ${{ runner.os }}-maven-
|
|
|
+ - uses: actions/checkout@v2
|
|
|
+ - name: Set up JDK 1.13
|
|
|
+ uses: actions/setup-java@v1
|
|
|
+ with:
|
|
|
+ java-version: 1.13
|
|
|
+ - name: Update development version
|
|
|
+ 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
|
|
|
+ id: prep
|
|
|
+ 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
|
|
|
+ echo ::set-output name=version::${VERSION}
|
|
|
+ - name: Build with Maven
|
|
|
+ run: mvn clean package -Pprod
|
|
|
+#################
|
|
|
+# #
|
|
|
+# Docker images #
|
|
|
+# #
|
|
|
+#################
|
|
|
+ - name: Set up QEMU
|
|
|
+ uses: docker/setup-qemu-action@v1
|
|
|
+ - name: Set up Docker Buildx
|
|
|
+ uses: docker/setup-buildx-action@v1
|
|
|
+ - name: Cache Docker layers
|
|
|
+ uses: actions/cache@v2
|
|
|
+ with:
|
|
|
+ path: /tmp/.buildx-cache
|
|
|
+ key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
|
+ restore-keys: |
|
|
|
+ ${{ runner.os }}-buildx-
|
|
|
+ - name: Login to DockerHub
|
|
|
+ if: github.ref == 'refs/heads/master'
|
|
|
+ uses: docker/login-action@v1
|
|
|
+ with:
|
|
|
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
+ - name: Build and push
|
|
|
+ id: docker_build
|
|
|
+ uses: docker/build-push-action@v2
|
|
|
+ with:
|
|
|
+ builder: ${{ steps.buildx.outputs.name }}
|
|
|
+ context: kafka-ui-api
|
|
|
+ push: github.ref == 'refs/heads/master'
|
|
|
+ tags: provectuslabs/kafka-ui:${{ steps.prep.outputs.version }}
|
|
|
+ build-args: |
|
|
|
+ JAR_FILE=kafka-ui-api-${{ steps.prep.outputs.version }}.jar
|
|
|
+ cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
+ cache-to: type=local,dest=/tmp/.buildx-cache
|