Skip to content

Commit 7d41571

Browse files
committed
github actions
1 parent 487daf3 commit 7d41571

File tree

4 files changed

+267
-0
lines changed

4 files changed

+267
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- master
9+
- main
10+
pull_request:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-24.04
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version-file: go.mod
26+
27+
- name: Install Task
28+
uses: arduino/setup-task@v2
29+
with:
30+
version: 3.x
31+
32+
- name: task generate
33+
run: |
34+
task generate --verbose
35+
git diff --exit-code
36+
37+
- name: task validate
38+
run: task validate --verbose
39+
40+
- name: task test
41+
run: task test --verbose

.github/workflows/publish.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
workflow_dispatch:
8+
9+
permissions:
10+
packages: write
11+
12+
env:
13+
OCI_URL: ghcr.io/openmcp-project
14+
15+
jobs:
16+
release_tag:
17+
name: Release version
18+
runs-on: ubuntu-24.04
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
ssh-key: ${{ secrets.PUSH_KEY }}
24+
fetch-tags: true
25+
fetch-depth: 0
26+
submodules: recursive
27+
28+
- name: Install Task
29+
uses: arduino/setup-task@v2
30+
with:
31+
version: 3.x
32+
33+
- name: Read and validate VERSION
34+
id: version
35+
run: |
36+
VERSION=$(task version)
37+
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev(-[0-9a-f]*)?)?$ ]]; then
38+
echo "Invalid version format: $VERSION"
39+
exit 1
40+
fi
41+
echo "New version: $VERSION"
42+
echo "version=$VERSION" >> $GITHUB_ENV
43+
44+
- name: Skip release if version is a dev version
45+
if: contains(env.version, '-dev')
46+
run: |
47+
echo "Skipping development version release: ${{ env.version }}"
48+
echo "SKIP=true" >> $GITHUB_ENV
49+
exit 0
50+
51+
- name: Set up QEMU
52+
uses: docker/setup-qemu-action@v3
53+
54+
- name: Set up Docker Context for Buildx
55+
id: buildx-context
56+
run: |
57+
docker context create builders
58+
59+
- name: Login to GitHub Container Registry
60+
uses: docker/login-action@v3
61+
with:
62+
registry: ghcr.io
63+
username: ${{ github.actor }}
64+
password: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- name: Set up Docker Buildx
67+
timeout-minutes: 5
68+
uses: docker/setup-buildx-action@v3
69+
with:
70+
version: latest
71+
72+
- name: Set up Go
73+
uses: actions/setup-go@v5
74+
with:
75+
go-version-file: go.mod
76+
77+
- name: Build and Push Images
78+
run: |
79+
task build:img:all --verbose
80+
81+
- name: Package and Push Helm Charts
82+
run: |
83+
task build:helm:all --verbose
84+
85+
- name: Build and Push OCM Component
86+
run: |
87+
task build:ocm:all --verbose

.github/workflows/release.yaml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Versioned Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write # we need this to be able to push tags
10+
pull-requests: read
11+
12+
jobs:
13+
release_tag:
14+
name: Release version
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
ssh-key: ${{ secrets.PUSH_KEY }}
21+
fetch-tags: true
22+
fetch-depth: 0
23+
submodules: recursive
24+
25+
- name: Install Task
26+
uses: arduino/setup-task@v2
27+
with:
28+
version: 3.x
29+
30+
- name: Read and validate VERSION
31+
id: version
32+
run: |
33+
VERSION=$(task version)
34+
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev(-[0-9a-f]*)?)?$ ]]; then
35+
echo "Invalid version format: $VERSION"
36+
exit 1
37+
fi
38+
echo "New version: $VERSION"
39+
echo "version=$VERSION" >> $GITHUB_ENV
40+
41+
- name: Skip release if version is a dev version
42+
if: contains(env.version, '-dev')
43+
run: |
44+
echo "Skipping development version release: ${{ env.version }}"
45+
echo "SKIP=true" >> $GITHUB_ENV
46+
exit 0
47+
48+
- name: Check if VERSION is already tagged
49+
id: check_tag
50+
run: |
51+
if git rev-parse "refs/tags/${{ env.version }}" >/dev/null 2>&1; then
52+
echo "Tag ${{ env.version }} already exists. Skipping release."
53+
echo "SKIP=true" >> $GITHUB_ENV
54+
exit 0
55+
fi
56+
echo "Tag ${{ env.version }} doesn't exists. Proceeding with release."
57+
58+
- name: Create Git tag
59+
if: ${{ env.SKIP != 'true' }}
60+
run: |
61+
AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
62+
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
63+
echo "Tagging as $AUTHOR_NAME <$AUTHOR_EMAIL>"
64+
65+
echo "AUTHOR_NAME=$AUTHOR_NAME" >> $GITHUB_ENV
66+
echo "AUTHOR_EMAIL=$AUTHOR_EMAIL" >> $GITHUB_ENV
67+
68+
git config user.name "$AUTHOR_NAME"
69+
git config user.email "$AUTHOR_EMAIL"
70+
71+
git tag -a "${{ env.version }}" -m "Release ${{ env.version }}"
72+
git push origin "${{ env.version }}"
73+
74+
- name: Build Changelog
75+
id: github_release
76+
uses: mikepenz/release-changelog-builder-action@v5
77+
with:
78+
mode: "PR"
79+
configurationJson: |
80+
{
81+
"template": "#{{CHANGELOG}}",
82+
"pr_template": "- #{{TITLE}}: ##{{NUMBER}}",
83+
"categories": [
84+
{
85+
"title": "## Feature",
86+
"labels": ["feat", "feature"]
87+
},
88+
{
89+
"title": "## Fix",
90+
"labels": ["fix", "bug"]
91+
},
92+
{
93+
"title": "## Other",
94+
"labels": []
95+
}
96+
],
97+
"label_extractor": [
98+
{
99+
"pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)",
100+
"on_property": "title",
101+
"target": "$1"
102+
}
103+
]
104+
}
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
108+
- name: Create GitHub release
109+
if: ${{ env.SKIP != 'true' }}
110+
uses: softprops/action-gh-release@v2
111+
with:
112+
tag_name: ${{ env.version }}
113+
name: Release ${{ env.version }}
114+
body: ${{steps.github_release.outputs.changelog}}
115+
draft: true
116+
prerelease: false
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
120+
- name: Push dev VERSION
121+
if: ${{ env.SKIP != 'true' }}
122+
run: |
123+
task release:set-version --verbose -- "${{ env.version }}-dev"
124+
git config user.name "${{ env.AUTHOR_NAME }}"
125+
git config user.email "${{ env.AUTHOR_EMAIL }}"
126+
git add VERSION
127+
git commit -m "Update VERSION to ${{ env.version }}-dev"
128+
git push origin main

.github/workflows/reuse.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: REUSE Compliance Check
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: REUSE Compliance Check
11+
uses: fsfe/reuse-action@v5

0 commit comments

Comments
 (0)