Skip to content

Commit 6680d9c

Browse files
committed
Add CI GitHub action
Add tbump.toml files for versioning
1 parent 65e1fb4 commit 6680d9c

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "operator-v*"
9+
- "server-v*"
10+
pull_request:
11+
branches:
12+
- *
13+
14+
jobs:
15+
changed-dirs:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
changeDirs: ${{ steps.outputStep.outputs.changeDirs }}
19+
steps:
20+
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 2
24+
25+
- name: Get changed dirs # To check if any files changed in a directory
26+
id: changeDirsStep
27+
uses: tj-actions/changed-files@v44
28+
with:
29+
dir_names: true
30+
files: |
31+
*
32+
- id: outputStep
33+
run: echo "::set-output name=changeDirs::${{ steps.changeDirsStep.outputs.all_changed_files }}"
34+
35+
docker:
36+
runs-on: ubuntu-latest
37+
needs:
38+
- changed-dirs
39+
if: startsWith(needs.init.outputs.changeDirs, 'operator') || startsWith(needs.init.outputs.changeDirs, 'server')
40+
strategy:
41+
matrix:
42+
include:
43+
- image: your-docker-registry/app1
44+
dockerfile: operator/Dockerfile
45+
directory: operator
46+
- image: user/app2
47+
dockerfile: server/Dockerfile
48+
directory: server
49+
steps:
50+
- name: Docker metadata
51+
id: meta
52+
uses: docker/metadata-action@v5
53+
with:
54+
# list of Docker images to use as base name for tags
55+
images: ${{ matrix.image }}
56+
# generate Docker tags based on the following events/attributes
57+
tags: |
58+
type=ref,event=branch
59+
type=match,pattern=\w+-v(\d.+),group=1
60+
type=ref,event=tag
61+
type=sha
62+
63+
- name: Set up QEMU
64+
uses: docker/setup-qemu-action@v3
65+
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
69+
- name: Login to GitHub Container Registry
70+
uses: docker/login-action@v3
71+
with:
72+
registry: ${{ env.REGISTRY }}
73+
username: ${{ github.actor }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Build and push
77+
uses: docker/build-push-action@v6
78+
if: startsWith(needs.init.outputs.changeDirs, matrix.directory)
79+
with:
80+
context: .
81+
file: ${{ matrix.dockerfile }}
82+
platforms: linux/amd64,linux/arm64
83+
push: ${{ github.event_name == 'pull_request' }}
84+
tags: ${{ steps.meta.outputs.tags }}
85+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
# config-server-operator
33

4+
![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FTU-Wien-dataLAB%2Fconfig-server-operator%2Fmain%2Fpyproject.toml%3Ftoken%3DGHSAT0AAAAAACGUZZXQLY7KSD64CM5CM5FOZULV5QA)
5+
6+
47
This operator provides CRDs to create key/value pairs (`KeyValuePair`). The operator combines these configuration objects into a single `ConfigMap` and deploys a REST API that can be used to access the individual values with the corresponding keys.
58

69

operator/tbump.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Uncomment this if your project is hosted on GitHub:
2+
# github_url = "https://github.com/<user or organization>/<project>/"
3+
4+
[version]
5+
current = "0.0.1"
6+
7+
# Example of a semver regexp.
8+
# Make sure this matches current_version before
9+
# using tbump
10+
regex = '''
11+
(?P<major>\d+)
12+
\.
13+
(?P<minor>\d+)
14+
\.
15+
(?P<patch>\d+)
16+
'''
17+
18+
[git]
19+
message_template = "Bump operator to {new_version}"
20+
tag_template = "operator-v{new_version}"

server/tbump.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Uncomment this if your project is hosted on GitHub:
2+
# github_url = "https://github.com/<user or organization>/<project>/"
3+
4+
[version]
5+
current = "0.0.1"
6+
7+
# Example of a semver regexp.
8+
# Make sure this matches current_version before
9+
# using tbump
10+
regex = '''
11+
(?P<major>\d+)
12+
\.
13+
(?P<minor>\d+)
14+
\.
15+
(?P<patch>\d+)
16+
'''
17+
18+
[git]
19+
message_template = "Bump server to {new_version}"
20+
tag_template = "server-v{new_version}"
21+

0 commit comments

Comments
 (0)