add latest build

This commit is contained in:
RustamGimadiev 2021-03-04 17:34:18 +03:00
parent 36a5bbf9b1
commit 8aa6814e6f
6 changed files with 154 additions and 45 deletions

View file

@ -1,20 +1,19 @@
name: backend
on:
push:
branches: [ '*' ]
pull_request:
branches: [ master ]
branches:
- "**"
- "!master"
jobs:
mvn-all-build:
build:
runs-on: ubuntu-latest
steps:
- name: Cache local Maven repository
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-all-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-all-
${{ runner.os }}-maven-
- uses: actions/checkout@v2
- name: Set up JDK 1.13

View file

@ -1,31 +0,0 @@
name: charts
on:
create:
tags:
- "v*.*.*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: |
git config user.name github-actions
git config user.email github-actions@github.com
- uses: azure/setup-helm@v1
- name: update appVersion
run: |
export version=${GITHUB_REF##*/}
sed -i "s/appVersion:.*/appVersion: ${version}/" charts/kafka-ui/Chart.yaml
- name:
run: |
export VERSION=${GITHUB_REF##*/}
MSG=$(helm package --app-version ${VERSION} charts/kafka-ui)
git fetch origin
git stash
git checkout -b gh-pages origin/gh-pages
helm repo index .
git add -f ${MSG##*/} index.yaml
git commit -m "release ${VERSION}"
git push

View file

@ -1,9 +1,9 @@
name: frontend
on:
push:
branches: [ '*' ]
pull_request:
branches: [ master ]
branches:
- "**"
- "!master"
jobs:
npm-test:
needs: [mvn-contract-build]

60
.github/workflows/latest.yaml vendored Normal file
View file

@ -0,0 +1,60 @@
name: latest
on:
workflow_dispatch:
push:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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-
- name: Set up JDK 1.13
uses: actions/setup-java@v1
with:
java-version: 1.13
- name: Build
id: build
run: |
export VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
mvn clean package -Pprod -DskipTests
#################
# #
# 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
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build_and_push
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: kafka-ui-api
push: true
tags: provectuslabs/kafka-ui:latest
build-args: |
JAR_FILE=kafka-ui-api-${{ steps.build.outputs.version }}.jar
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

View file

@ -59,19 +59,32 @@ jobs:
${{ runner.os }}-buildx-
- name: Login to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v1
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
- name: Build
if: github.ref != 'refs/heads/master'
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 }}
push: false
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
- name: Build and push
if: github.ref == 'refs/heads/master'
id: docker_build_and_push
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: kafka-ui-api
push: true
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

68
.github/workflows/tags.yaml vendored Normal file
View file

@ -0,0 +1,68 @@
name: after_release
on:
push:
tags:
- "v**"
jobs:
charts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- run: |
git config user.name github-actions
git config user.email github-actions@github.com
- uses: azure/setup-helm@v1
- name: update appVersion
run: |
export version=${GITHUB_REF##*/}
sed -i "s/appVersion:.*/appVersion: ${version}/" charts/kafka-ui/Chart.yaml
- name:
run: |
export VERSION=${GITHUB_REF##*/}
MSG=$(helm package --app-version ${VERSION} charts/kafka-ui)
git fetch origin
git stash
git checkout -b gh-pages origin/gh-pages
helm repo index .
git add -f ${MSG##*/} index.yaml
git commit -m "release ${VERSION}"
git push
gh-release:
runs-on: ubuntu-latest
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=${GITHUB_REF##*/}
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}"
echo "::set-output name=version::${VERSION}"
- id: create_release
uses: actions/github-script@v3
env:
CHANGELOG: ${{steps.generate.outputs.changelog}}
VERSION: ${{steps.generate.outputs.version}}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: context.ref,
name: "Release "+process.env.VERSION,
body: process.env.CHANGELOG,
draft: false,
prerelease: false
});