Skip to content

Fix GitHub release workflow (#33) #53

Fix GitHub release workflow (#33)

Fix GitHub release workflow (#33) #53

name: Build and Publish
on:
push:
tags: ["**"]
branches: ["**"]
env:
java-version: 21
gradle-version: 8.4
gradle-cache: true
gradle-cache-read-only: true
gradle-refresh-dependencies: false
working-directory: "./word-count/code"
jobs:
build-and-test:
name: Build, Test and Assess code quality
uses: bakdata/ci-templates/.github/workflows/[email protected]
with:
java-version: 21
gradle-version: 8.4
gradle-cache: true
gradle-cache-read-only: false
gradle-refresh-dependencies: false
working-directory: "./word-count/code"
secrets:
signing-key-id: ${{ secrets.SONATYPE_SIGNING_KEY_ID }}
signing-password: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
signing-secret-key-ring: ${{ secrets.SONATYPE_SIGNING_SECRET_KEY_RING }}
sonar-token: ${{ secrets.SONARCLOUD_TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD_ORGANIZATION }}
build-jib:
name: Build images
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ${{ env.working-directory }}
needs: build-and-test
steps:
- name: Login into docker
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push sentence producer image
uses: bakdata/ci-templates/actions/[email protected]
with:
full-image-name: bakdata/kpops-demo-sentence-producer
class: com.bakdata.kpops.examples.SentenceProducer
java-version: ${{ env.java-version }}
gradle-version: ${{ env.gradle-version }}
gradle-cache: true
gradle-cache-read-only: ${{ env.gradle-cache-read-only }}
gradle-refresh-dependencies: ${{ env.gradle-refresh-dependencies }}
working-directory: ${{ env.working-directory }}
- name: Build and push word count image
uses: bakdata/ci-templates/actions/[email protected]
with:
full-image-name: bakdata/kpops-demo-word-count-app
class: com.bakdata.kpops.examples.WordCountApplication
java-version: ${{ env.java-version }}
gradle-version: ${{ env.gradle-version }}
gradle-cache: ${{ env.gradle-cache }}
gradle-cache-read-only: ${{ env.gradle-cache-read-only }}
gradle-refresh-dependencies: ${{ env.gradle-refresh-dependencies }}
working-directory: ${{ env.working-directory }}
release:
name: Create Github release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
needs: [build-and-test, build-jib]
steps:
- name: Release on Github
uses: bakdata/ci-templates/actions/[email protected]
with:
github-token: ${{ secrets.GH_TOKEN }}
java-version: ${{ env.java-version }}
gradle-version: ${{ env.gradle-version }}
gradle-cache: ${{ env.gradle-cache }}
gradle-cache-read-only: ${{ env.gradle-cache-read-only }}
gradle-refresh-dependencies: ${{ env.gradle-refresh-dependencies }}
working-directory: ${{ env.working-directory }}