Skip to content

Commit 5e69b2a

Browse files
committed
feat: reuse common workflows
1 parent 9b232de commit 5e69b2a

File tree

5 files changed

+32
-241
lines changed

5 files changed

+32
-241
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,10 @@ on:
99
- main
1010
pull_request:
1111

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
12+
permissions:
13+
contents: read
3114

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
15+
jobs:
16+
build_validate_test:
17+
uses: openmcp-project/build/.github/workflows/ci.lib.yaml@main
18+
secrets: inherit

.github/workflows/publish.yaml

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -9,79 +9,7 @@ on:
99
permissions:
1010
packages: write
1111

12-
env:
13-
OCI_URL: ghcr.io/openmcp-project
14-
1512
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
13+
release_publish:
14+
uses: openmcp-project/build/.github/workflows/publish.lib.yaml@main
15+
secrets: inherit

.github/workflows/release.yaml

Lines changed: 2 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -11,134 +11,5 @@ permissions:
1111

1212
jobs:
1313
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: Create Git tag for api submodule
75-
if: ${{ env.SKIP != 'true' }}
76-
run: |
77-
AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
78-
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
79-
echo "Tagging as $AUTHOR_NAME <$AUTHOR_EMAIL>"
80-
81-
echo "AUTHOR_NAME=$AUTHOR_NAME" >> $GITHUB_ENV
82-
echo "AUTHOR_EMAIL=$AUTHOR_EMAIL" >> $GITHUB_ENV
83-
84-
git config user.name "$AUTHOR_NAME"
85-
git config user.email "$AUTHOR_EMAIL"
86-
87-
git tag -a "api/${{ env.version }}" -m "Release ${{ env.version }}"
88-
git push origin "api/${{ env.version }}"
89-
90-
- name: Build Changelog
91-
id: github_release
92-
uses: mikepenz/release-changelog-builder-action@v5
93-
with:
94-
mode: "PR"
95-
configurationJson: |
96-
{
97-
"template": "#{{CHANGELOG}}",
98-
"pr_template": "- #{{TITLE}}: ##{{NUMBER}}",
99-
"categories": [
100-
{
101-
"title": "## Feature",
102-
"labels": ["feat", "feature"]
103-
},
104-
{
105-
"title": "## Fix",
106-
"labels": ["fix", "bug"]
107-
},
108-
{
109-
"title": "## Other",
110-
"labels": []
111-
}
112-
],
113-
"label_extractor": [
114-
{
115-
"pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)",
116-
"on_property": "title",
117-
"target": "$1"
118-
}
119-
]
120-
}
121-
env:
122-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123-
124-
- name: Create GitHub release
125-
if: ${{ env.SKIP != 'true' }}
126-
uses: softprops/action-gh-release@v2
127-
with:
128-
tag_name: ${{ env.version }}
129-
name: Release ${{ env.version }}
130-
body: ${{steps.github_release.outputs.changelog}}
131-
draft: true
132-
prerelease: false
133-
env:
134-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135-
136-
- name: Push dev VERSION
137-
if: ${{ env.SKIP != 'true' }}
138-
run: |
139-
task release:set-version --verbose -- "${{ env.version }}-dev"
140-
git config user.name "${{ env.AUTHOR_NAME }}"
141-
git config user.email "${{ env.AUTHOR_EMAIL }}"
142-
git add VERSION
143-
git commit -m "Update VERSION to ${{ env.version }}-dev"
144-
git push origin main
14+
uses: openmcp-project/build/.github/workflows/release.lib.yaml@main
15+
secrets: inherit

.github/workflows/reuse.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: REUSE Compliance Check
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
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
9+
run_reuse:
10+
uses: openmcp-project/build/.github/workflows/reuse.lib.yaml@main
11+
secrets: inherit
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Validate Pull Request Content
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
validate_pr_content:
14+
uses: openmcp-project/build/.github/workflows/validate-pr-content.lib.yaml@main
15+
secrets: inherit

0 commit comments

Comments
 (0)