diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 79c2681816..97054ff950 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -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 diff --git a/.github/workflows/charts.yaml b/.github/workflows/charts.yaml deleted file mode 100644 index f52c09bf1d..0000000000 --- a/.github/workflows/charts.yaml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/.github/workflows/frontend.yaml b/.github/workflows/frontend.yaml index 331e766154..111446b677 100644 --- a/.github/workflows/frontend.yaml +++ b/.github/workflows/frontend.yaml @@ -1,9 +1,9 @@ name: frontend on: push: - branches: [ '*' ] - pull_request: - branches: [ master ] + branches: + - "**" + - "!master" jobs: npm-test: needs: [mvn-contract-build] diff --git a/.github/workflows/latest.yaml b/.github/workflows/latest.yaml new file mode 100644 index 0000000000..f6ea7bf777 --- /dev/null +++ b/.github/workflows/latest.yaml @@ -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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6a95f1ca21..8b1877e477 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 \ No newline at end of file diff --git a/.github/workflows/tags.yaml b/.github/workflows/tags.yaml new file mode 100644 index 0000000000..562d0f5214 --- /dev/null +++ b/.github/workflows/tags.yaml @@ -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 + });