Skip to content

Commit

Permalink
Release process (#196)
Browse files Browse the repository at this point in the history
* publish tag for aggregator

* contributing

* github action for tags

* update docker file base image

* release tags should start with v

* fix version variable
  • Loading branch information
gaetancollaud authored Aug 20, 2024
1 parent 1a7b2ae commit 2d474e4
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 10 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/build-aggregator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Build aggregator
on:
push:
branches: [ master ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ master ]
paths: ['aggregator/**']
Expand All @@ -14,6 +16,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Write release version
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -42,17 +51,26 @@ jobs:
run: mvn -B clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=spoud_kafka-cost-control -Pfailsafe

- name: Login to Docker Hub
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
- name: Build and push latest
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: aggregator/
file: aggregator/src/main/docker/Dockerfile.jvm
push: true
tags: spoud/kafka-cost-control:latest

- name: Build and push tag
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: aggregator/
file: aggregator/src/main/docker/Dockerfile.jvm
push: true
tags: spoud/kafka-cost-control:${{ env.VERSION }}
22 changes: 20 additions & 2 deletions .github/workflows/build-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Build frontend
on:
push:
branches: [ master ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ master ]
paths: [ 'frontend/**' ]
Expand All @@ -14,6 +16,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Write release version
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Install dependencies
working-directory: frontend/
run: npm install
Expand All @@ -40,7 +49,7 @@ jobs:
publish:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')

steps:

Expand All @@ -56,9 +65,18 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
- name: Build and push latest
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: frontend/
push: true
tags: spoud/kafka-cost-control-ui:latest

- name: Build and push tag
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: frontend/
push: true
tags: spoud/kafka-cost-control-ui:${{ env.VERSION }}
20 changes: 19 additions & 1 deletion .github/workflows/build-kafka-connect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Build Kafka connect
on:
push:
branches: [ master ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
paths: ['kafka-connect/**']

jobs:
Expand All @@ -12,15 +14,31 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Write release version
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
- name: Build and push latest
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: kafka-connect/
push: true
tags: spoud/kafka-cost-control-connect:latest

- name: Build and push tag
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: kafka-connect/
push: true
tags: spoud/kafka-cost-control-connect:${{ env.VERSION }}
33 changes: 30 additions & 3 deletions .github/workflows/build-scraper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Build scraper
on:
push:
branches: [ master ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ master ]
paths: ['kafka-scraper/**']
Expand All @@ -14,6 +16,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Write release version
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
Expand All @@ -30,13 +39,13 @@ jobs:
run: mvn --batch-mode package -DskipTests -Pnative

- name: Login to Docker Hub
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push jvm image
- name: Build and push latest jvm image
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
Expand All @@ -45,11 +54,29 @@ jobs:
push: true
tags: spoud/kafka-cost-control-scraper:latest-jvm

- name: Build and push native
- name: Build and push lastest native image
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
with:
context: kafka-scraper/
file: kafka-scraper/src/main/docker/Dockerfile.native-micro
push: true
tags: spoud/kafka-cost-control-scraper:latest-native

- name: Build and push tagged jvm image
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: kafka-scraper/
file: kafka-scraper/src/main/docker/Dockerfile.jvm
push: true
tags: spoud/kafka-cost-control-scraper:${{ env.VERSION }}-jvm

- name: Build and push tagged native image
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: kafka-scraper/
file: kafka-scraper/src/main/docker/Dockerfile.native-micro
push: true
tags: spoud/kafka-cost-control-scraper:${{ env.VERSION }}-native
24 changes: 24 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

name: Create Release

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributing Guides

### Pre-requisites
- git
- docker
- maven
- npm

## How to get started

### Aggregator

Go in the folder `aggregator`. Compile using `mvn clean package`. We're using [Quarkus Framework](https://quarkus.io/). If you want to run the development mode, use `mvn quarkus:dev`.

### Kafka scraper

Go in the folder `kafka-scraper`. Compile using `mvn clean package`. We're using [Quarkus Framework](https://quarkus.io/). If you want to run the development mode, use `mvn quarkus:dev`.

### Frontend

Go in the folder `frontend`. Compile using `npm install`. We're using the [Angular Framework](https://angular.dev/). Run in dev mode using `npm start`.

### Kafka Connect

Go the folder `kafka-connect`. Compile using `docker compose build`. We're using [Kafka Connect](https://kafka.apache.org/documentation/#connect).

## Contributing to this repo

Bug reports and feature requests are welcome. Please fill up a GitHub issue.

Before contributing to a code change, please discuss your idea with the maintainers in an issue.

Every change should be made with a pull request. First fork the repos, create a branch on our repos and create a pull request on this repository. Put the [code owners](./CODEOWNERS) as reviewers.

## Releases

Releases are made through git tags using semantic versioning. Where `MAJOR.MINOR.PATH`:
- `MAJOR` version when you make incompatible API changes,
- `MINOR` version when you add functionality in a backwards compatible manner, and
- `PATCH` version when you make backwards compatible bug fixes or dependencies update.

To create a release you should push a tag starting with `v`to the master branch. For example
```bash
git tag v0.1.2
git push --tags
```
2 changes: 1 addition & 1 deletion aggregator/src/main/docker/Dockerfile.jvm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-21:1.18
FROM registry.access.redhat.com/ubi8/openjdk-21:1.20-2

ENV LANGUAGE='en_US:en'

Expand Down
2 changes: 1 addition & 1 deletion kafka-scraper/src/main/docker/Dockerfile.jvm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-21:1.18
FROM registry.access.redhat.com/ubi8/openjdk-21:1.20-2

ENV LANGUAGE='en_US:en'

Expand Down

0 comments on commit 2d474e4

Please sign in to comment.