Skip to content

Commit 57b4b10

Browse files
authored
Add release automation configuration (#1)
1 parent f8bb12a commit 57b4b10

7 files changed

Lines changed: 307 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Versioned Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: write # we need this to be able to push tags
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
19+
with:
20+
ssh-key: ${{ secrets.PUSH_KEY }}
21+
fetch-tags: true
22+
fetch-depth: 0
23+
submodules: recursive
24+
25+
- name: Read and validate VERSION
26+
id: version
27+
run: |
28+
VERSION=$(cat VERSION)
29+
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-dev(-[0-9a-f]*)?)?$ ]]; then
30+
echo "Invalid version format: $VERSION"
31+
exit 1
32+
fi
33+
echo "New version: $VERSION"
34+
echo "version=$VERSION" >> $GITHUB_ENV
35+
36+
- name: Check if VERSION is already tagged
37+
id: check_tag
38+
run: |
39+
if git rev-parse "refs/tags/${{ env.version }}" >/dev/null 2>&1; then
40+
echo "Tag ${{ env.version }} already exists. Skipping release."
41+
echo "SKIP=true" >> $GITHUB_ENV
42+
exit 0
43+
fi
44+
echo "Tag ${{ env.version }} doesn't exists. Proceeding with release."
45+
46+
- name: Skip release if version is a dev version
47+
if: contains(env.version, '-dev')
48+
run: |
49+
echo "Skipping development version release: ${{ env.version }}"
50+
echo "SKIP=true" >> $GITHUB_ENV
51+
exit 0
52+
53+
- name: Login to GitHub Container Registry
54+
uses: docker/login-action@v3
55+
with:
56+
registry: ghcr.io
57+
username: ${{ github.actor }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: setup OCM
61+
uses: open-component-model/ocm-setup-action@main
62+
63+
- name: Create OCM CTF
64+
run: |
65+
ocm add componentversions --create \
66+
--file openmcp-ctf component-constructor.yaml \
67+
--settings components-versions.yaml -- OPENMCP_VERSION=${{ env.version }}
68+
69+
- name: Build Changelog
70+
id: constructed_release
71+
run: |
72+
cat hack/release-body.tpl > RELEASE_BODY.md
73+
echo "${{ github.event.pull_request.body }}" >> RELEASE_BODY.md
74+
echo -e "## Components:\n" >> RELEASE_BODY.md
75+
./hack/generate_release_notes.sh openmcp-ctf >> RELEASE_BODY.md
76+
77+
- name: Create Git tag
78+
if: ${{ env.SKIP != 'true' }}
79+
run: |
80+
AUTHOR_NAME=$(git log -1 --pretty=format:'%an')
81+
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
82+
echo "Tagging as $AUTHOR_NAME <$AUTHOR_EMAIL>"
83+
84+
echo "AUTHOR_NAME=$AUTHOR_NAME" >> $GITHUB_ENV
85+
echo "AUTHOR_EMAIL=$AUTHOR_EMAIL" >> $GITHUB_ENV
86+
87+
git config user.name "$AUTHOR_NAME"
88+
git config user.email "$AUTHOR_EMAIL"
89+
90+
git tag -a "${{ env.version }}" -m "Release ${{ env.version }}"
91+
git push origin "${{ env.version }}"
92+
93+
94+
- name: Create GitHub release
95+
if: ${{ env.SKIP != 'true' }}
96+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2
97+
with:
98+
tag_name: ${{ env.version }}
99+
name: Release ${{ env.version }}
100+
body: RELEASE_BODY.md
101+
draft: true
102+
prerelease: false
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
106+
- name: Push CTF
107+
run: |
108+
ocm transfer ctf --overwrite ./openmcp-ctf/ ${{ env.OCI_URL }}

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.0-dev

component-constructor.yaml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# yaml-language-server: $schema=https://ocm.software/schemas/configuration-schema.yaml
2+
3+
components:
4+
- name: github.com/openmcp-project/openmcp
5+
version: "${OPENMCP_VERSION}"
6+
provider:
7+
name: openmcp-project
8+
componentReferences:
9+
- componentName: github.com/openmcp-project/mcp-operator
10+
name: mcp-operator
11+
version: ${MCP_OPERATOR_VERSION}
12+
13+
- componentName: github.com/openmcp-project/openmcp-operator
14+
name: openmcp-operator
15+
version: ${OPENMCP_OPERATOR_VERSION}
16+
17+
- componentName: github.com/openmcp-project/control-plane-operator
18+
name: control-plane-operator
19+
version: ${CONTROL_PLANE_OPERATOR_VERSION}
20+
21+
- componentName: github.com/openmcp-project/quota-operator
22+
name: quota-operator
23+
version: ${QUOTA_OPERATOR_VERSION}
24+
25+
- componentName: github.com/openmcp-project/project-workspace-operator
26+
name: project-workspace-operator
27+
version: ${PROJECT_WORKSPACE_OPERATOR_VERSION}
28+
29+
sources:
30+
- access:
31+
commit: "${OPENMCP_VERSION}"
32+
type: gitHub
33+
repoUrl: https://github.com/openmcp-project/openmcp
34+
ref: refs/heads/main
35+
name: openmcp
36+
type: git
37+
version: ${OPENMCP_VERSION}
38+
39+
- name: github.com/openmcp-project/mcp-operator
40+
version: ${MCP_OPERATOR_VERSION}
41+
provider:
42+
name: openmcp-project
43+
resources:
44+
- name: mcp-operator-image
45+
type: ociImage
46+
version: ${MCP_OPERATOR_VERSION}
47+
access:
48+
type: ociArtifact
49+
imageReference: ghcr.io/openmcp-project/images/mcp-operator:${MCP_OPERATOR_VERSION}
50+
- name: mcp-operator-chart
51+
type: helmChart
52+
version: ${MCP_OPERATOR_VERSION}
53+
access:
54+
type: ociArtifact
55+
imageReference: ghcr.io/openmcp-project/charts/mcp-operator:${MCP_OPERATOR_VERSION}
56+
sources:
57+
- access:
58+
commit: ${MCP_OPERATOR_VERSION}
59+
type: gitHub
60+
repoUrl: https://github.com/openmcp-project/mcp-operator
61+
ref: refs/heads/main
62+
name: openmcp
63+
type: git
64+
version: ${MCP_OPERATOR_VERSION}
65+
66+
- name: github.com/openmcp-project/openmcp-operator
67+
version: ${OPENMCP_OPERATOR_VERSION}
68+
provider:
69+
name: openmcp-project
70+
resources:
71+
- name: openmcp-operator-image
72+
type: ociImage
73+
version: ${OPENMCP_OPERATOR_VERSION}
74+
access:
75+
type: ociArtifact
76+
imageReference: ghcr.io/openmcp-project/images/openmcp-operator:${OPENMCP_OPERATOR_VERSION}
77+
sources:
78+
- access:
79+
commit: ${OPENMCP_OPERATOR_VERSION}
80+
type: gitHub
81+
repoUrl: https://github.com/openmcp-project/openmcp-operator
82+
ref: refs/heads/main
83+
name: openmcp
84+
type: git
85+
version: ${OPENMCP_OPERATOR_VERSION}
86+
87+
- name: github.com/openmcp-project/control-plane-operator
88+
version: ${CONTROL_PLANE_OPERATOR_VERSION}
89+
provider:
90+
name: openmcp-project
91+
resources:
92+
- name: control-plane-operator-image
93+
type: ociImage
94+
version: ${CONTROL_PLANE_OPERATOR_VERSION}
95+
access:
96+
type: ociArtifact
97+
imageReference: ghcr.io/openmcp-project/github.com/openmcp-project/control-plane-operator/images/control-plane-operator:${CONTROL_PLANE_OPERATOR_VERSION}
98+
- name: control-plane-operator-chart
99+
type: helmChart
100+
version: ${CONTROL_PLANE_OPERATOR_VERSION}
101+
access:
102+
type: ociArtifact
103+
imageReference: ghcr.io/openmcp-project/github.com/openmcp-project/control-plane-operator/charts/control-plane-operator:${CONTROL_PLANE_OPERATOR_VERSION}
104+
sources:
105+
- access:
106+
commit: ${CONTROL_PLANE_OPERATOR_VERSION}
107+
type: gitHub
108+
repoUrl: https://github.com/openmcp-project/control-plane-operator
109+
ref: refs/heads/main
110+
name: openmcp
111+
type: git
112+
version: ${CONTROL_PLANE_OPERATOR_VERSION}
113+
114+
- name: github.com/openmcp-project/quota-operator
115+
version: ${QUOTA_OPERATOR_VERSION}
116+
provider:
117+
name: openmcp-project
118+
resources:
119+
- name: quota-operator-image
120+
type: ociImage
121+
version: ${QUOTA_OPERATOR_VERSION}
122+
access:
123+
type: ociArtifact
124+
imageReference: ghcr.io/openmcp-project/images/quota-operator:${QUOTA_OPERATOR_VERSION}
125+
- name: quota-operator-chart
126+
type: helmChart
127+
version: ${QUOTA_OPERATOR_VERSION}
128+
access:
129+
type: ociArtifact
130+
imageReference: ghcr.io/openmcp-project/charts/quota-operator:${QUOTA_OPERATOR_VERSION}
131+
sources:
132+
- access:
133+
commit: ${QUOTA_OPERATOR_VERSION}
134+
type: gitHub
135+
repoUrl: https://github.com/openmcp-project/quota-operator
136+
ref: refs/heads/main
137+
name: openmcp
138+
type: git
139+
version: ${QUOTA_OPERATOR_VERSION}
140+
141+
142+
- name: github.com/openmcp-project/project-workspace-operator
143+
version: ${PROJECT_WORKSPACE_OPERATOR_VERSION}
144+
provider:
145+
name: openmcp-project
146+
resources:
147+
- name: project-workspace-operator-image
148+
type: ociImage
149+
version: ${PROJECT_WORKSPACE_OPERATOR_VERSION}
150+
access:
151+
type: ociArtifact
152+
imageReference: ghcr.io/openmcp-project/images/project-workspace-operator:${PROJECT_WORKSPACE_OPERATOR_VERSION}
153+
- name: project-workspace-operator-chart
154+
type: helmChart
155+
version: ${PROJECT_WORKSPACE_OPERATOR_VERSION}
156+
access:
157+
type: ociArtifact
158+
imageReference: ghcr.io/openmcp-project/charts/project-workspace-operator:${PROJECT_WORKSPACE_OPERATOR_VERSION}
159+
sources:
160+
- access:
161+
commit: ${PROJECT_WORKSPACE_OPERATOR_VERSION}
162+
type: gitHub
163+
repoUrl: https://github.com/openmcp-project/project-workspace-operator
164+
ref: refs/heads/main
165+
name: openmcp
166+
type: git
167+
version: ${PROJECT_WORKSPACE_OPERATOR_VERSION}
168+

components-versions.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONTROL_PLANE_OPERATOR_VERSION: "v0.1.5"
2+
QUOTA_OPERATOR_VERSION: "v0.5.0"
3+
PROJECT_WORKSPACE_OPERATOR_VERSION: "v0.12.0"
4+
MCP_OPERATOR_VERSION: "v0.27.0"
5+
OPENMCP_OPERATOR_VERSION: "v0.5.0"

hack/component.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"# \(.componentName) [[\(.tagName)](\(.url))]:
2+
3+
\(.body)"
4+

hack/generate_release_notes.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
if [ $# -lt 1 ]; then
3+
echo "Usage: $0 <ocm-ctf>"
4+
echo "Example: $0 openmcp-ctf/"
5+
exit 1
6+
fi
7+
8+
CTF_DIR="$1"
9+
10+
references=$(ocm get references "$CTF_DIR///github.com/openmcp-project/openmcp" -o json|jq -r '.items[].element | "\(.name) \(.componentName) \(.version)"')
11+
12+
echo "$references" | while read -r name repo version; do
13+
export REPO=$name
14+
gh release view "$version" --repo "$repo" --json tagName,body,url \
15+
| jq '. + {"componentName": env.REPO}' \
16+
| jq -r -f ./hack/component.tpl \
17+
| sed "s/^##\ /### /g" # improve formatting until upstream formatting is fixed.
18+
done

hack/release-body.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# MCP Landscape
2+
3+
## Highlights

0 commit comments

Comments
 (0)