Skip to content

Commit f471979

Browse files
authored
feat: reuse common workflows (#27)
1 parent 1af9acb commit f471979

File tree

5 files changed

+32
-257
lines changed

5 files changed

+32
-257
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
19-
with:
20-
submodules: recursive
21-
22-
- name: Set up Go
23-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # 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 & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -9,87 +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: Create GitHub App token
21-
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2
22-
id: app-token
23-
with:
24-
# required
25-
app-id: 1312871
26-
private-key: ${{ secrets.OPENMCP_CI_APP_PRIVATE_KEY }}
27-
28-
- name: Checkout code
29-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
30-
with:
31-
token: ${{ steps.app-token.outputs.token }}
32-
fetch-tags: true
33-
fetch-depth: 0
34-
submodules: recursive
35-
36-
- name: Install Task
37-
uses: arduino/setup-task@v2
38-
with:
39-
version: 3.x
40-
41-
- name: Read and validate VERSION
42-
id: version
43-
run: |
44-
VERSION=$(task version)
45-
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev(-[0-9a-f]*)?)?$ ]]; then
46-
echo "Invalid version format: $VERSION"
47-
exit 1
48-
fi
49-
echo "New version: $VERSION"
50-
echo "version=$VERSION" >> $GITHUB_ENV
51-
52-
- name: Skip release if version is a dev version
53-
if: contains(env.version, '-dev')
54-
run: |
55-
echo "Skipping development version release: ${{ env.version }}"
56-
echo "SKIP=true" >> $GITHUB_ENV
57-
exit 0
58-
59-
- name: Set up QEMU
60-
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
61-
62-
- name: Set up Docker Context for Buildx
63-
id: buildx-context
64-
run: |
65-
docker context create builders
66-
67-
- name: Login to GitHub Container Registry
68-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
69-
with:
70-
registry: ghcr.io
71-
username: ${{ github.actor }}
72-
password: ${{ secrets.GITHUB_TOKEN }}
73-
74-
- name: Set up Docker Buildx
75-
timeout-minutes: 5
76-
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
77-
with:
78-
version: latest
79-
80-
- name: Set up Go
81-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
82-
with:
83-
go-version-file: go.mod
84-
85-
- name: Build and Push Images
86-
run: |
87-
task build:img:all --verbose
88-
89-
- name: Package and Push Helm Charts
90-
run: |
91-
task build:helm:all --verbose
92-
93-
- name: Build and Push OCM Component
94-
run: |
95-
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 & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -11,142 +11,5 @@ permissions:
1111

1212
jobs:
1313
release_tag:
14-
name: Release version
15-
runs-on: ubuntu-24.04
16-
steps:
17-
- name: Create GitHub App token
18-
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2
19-
id: app-token
20-
with:
21-
# required
22-
app-id: 1312871
23-
private-key: ${{ secrets.OPENMCP_CI_APP_PRIVATE_KEY }}
24-
25-
- name: Checkout code
26-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
27-
with:
28-
token: ${{ steps.app-token.outputs.token }}
29-
fetch-tags: true
30-
fetch-depth: 0
31-
submodules: recursive
32-
33-
- name: Install Task
34-
uses: arduino/setup-task@v2
35-
with:
36-
version: 3.x
37-
38-
- name: Read and validate VERSION
39-
id: version
40-
run: |
41-
VERSION=$(task version)
42-
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev(-[0-9a-f]*)?)?$ ]]; then
43-
echo "Invalid version format: $VERSION"
44-
exit 1
45-
fi
46-
echo "New version: $VERSION"
47-
echo "version=$VERSION" >> $GITHUB_ENV
48-
49-
- name: Skip release if version is a dev version
50-
if: contains(env.version, '-dev')
51-
run: |
52-
echo "Skipping development version release: ${{ env.version }}"
53-
echo "SKIP=true" >> $GITHUB_ENV
54-
exit 0
55-
56-
- name: Check if VERSION is already tagged
57-
id: check_tag
58-
run: |
59-
if git rev-parse "refs/tags/${{ env.version }}" >/dev/null 2>&1; then
60-
echo "Tag ${{ env.version }} already exists. Skipping release."
61-
echo "SKIP=true" >> $GITHUB_ENV
62-
exit 0
63-
fi
64-
echo "Tag ${{ env.version }} doesn't exists. Proceeding with release."
65-
66-
- name: Create Git tag
67-
if: ${{ env.SKIP != 'true' }}
68-
run: |
69-
AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
70-
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
71-
echo "Tagging as $AUTHOR_NAME <$AUTHOR_EMAIL>"
72-
73-
echo "AUTHOR_NAME=$AUTHOR_NAME" >> $GITHUB_ENV
74-
echo "AUTHOR_EMAIL=$AUTHOR_EMAIL" >> $GITHUB_ENV
75-
76-
git config user.name "$AUTHOR_NAME"
77-
git config user.email "$AUTHOR_EMAIL"
78-
79-
git tag -a "${{ env.version }}" -m "Release ${{ env.version }}"
80-
git push origin "${{ env.version }}"
81-
82-
- name: Create Git tag for api submodule
83-
if: ${{ env.SKIP != 'true' }}
84-
run: |
85-
AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
86-
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
87-
echo "Tagging as $AUTHOR_NAME <$AUTHOR_EMAIL>"
88-
89-
echo "AUTHOR_NAME=$AUTHOR_NAME" >> $GITHUB_ENV
90-
echo "AUTHOR_EMAIL=$AUTHOR_EMAIL" >> $GITHUB_ENV
91-
92-
git config user.name "$AUTHOR_NAME"
93-
git config user.email "$AUTHOR_EMAIL"
94-
95-
git tag -a "api/${{ env.version }}" -m "Release ${{ env.version }}"
96-
git push origin "api/${{ env.version }}"
97-
98-
- name: Build Changelog
99-
id: github_release
100-
uses: mikepenz/release-changelog-builder-action@e92187bd633e680ebfdd15961a7c30b2d097e7ad # v5
101-
with:
102-
mode: "PR"
103-
configurationJson: |
104-
{
105-
"template": "#{{CHANGELOG}}",
106-
"pr_template": "- #{{TITLE}}: ##{{NUMBER}}",
107-
"categories": [
108-
{
109-
"title": "## Feature",
110-
"labels": ["feat", "feature"]
111-
},
112-
{
113-
"title": "## Fix",
114-
"labels": ["fix", "bug"]
115-
},
116-
{
117-
"title": "## Other",
118-
"labels": []
119-
}
120-
],
121-
"label_extractor": [
122-
{
123-
"pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)",
124-
"on_property": "title",
125-
"target": "$1"
126-
}
127-
]
128-
}
129-
env:
130-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131-
132-
- name: Create GitHub release
133-
if: ${{ env.SKIP != 'true' }}
134-
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2
135-
with:
136-
tag_name: ${{ env.version }}
137-
name: Release ${{ env.version }}
138-
body: ${{steps.github_release.outputs.changelog}}
139-
draft: true
140-
prerelease: false
141-
env:
142-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143-
144-
- name: Push dev VERSION
145-
if: ${{ env.SKIP != 'true' }}
146-
run: |
147-
task release:set-version --verbose -- "${{ env.version }}-dev"
148-
git config user.name "${{ env.AUTHOR_NAME }}"
149-
git config user.email "${{ env.AUTHOR_EMAIL }}"
150-
git add VERSION
151-
git commit -m "Update VERSION to ${{ env.version }}-dev"
152-
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
10-
- name: REUSE Compliance Check
11-
uses: fsfe/reuse-action@bb774aa972c2a89ff34781233d275075cbddf542 # 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)