Skip to content

Commit 6909307

Browse files
committed
chore: synchronized gha with frontend project
1 parent cc7bacb commit 6909307

File tree

3 files changed

+99
-57
lines changed

3 files changed

+99
-57
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
name: Build
22
on:
3-
push:
4-
branches:
5-
- main
6-
tags:
7-
- "*"
8-
9-
pull_request:
10-
branches:
11-
- main
12-
13-
workflow_dispatch:
3+
workflow_call:
144

155
env:
166
DOCKER_IMAGE: ghcr.io/${{ github.repository }}
@@ -27,53 +17,17 @@ jobs:
2717
steps:
2818
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
2919

30-
- name: Docker meta
31-
id: meta
32-
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 #v5.7.0
33-
with:
34-
# list of Docker images to use as base name for tags
35-
images: |
36-
${{ env.DOCKER_IMAGE }}
37-
# generate Docker tags based on the following events/attributes
38-
tags: |
39-
type=schedule
40-
type=ref,event=branch
41-
type=ref,event=pr
42-
type=semver,pattern={{version}}
43-
type=semver,pattern={{major}}.{{minor}}
44-
type=semver,pattern={{major}}
45-
type=raw,value=latest,enable={{is_default_branch}}
46-
47-
- name: Login to Docker Registry
48-
if: github.event_name != 'pull_request'
49-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 #v3.4.0
20+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 #v5.5.0
5021
with:
51-
registry: ghcr.io
52-
username: ${{ github.repository_owner }}
53-
password: ${{ secrets.GITHUB_TOKEN }}
54-
55-
- name: Set up QEMU
56-
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 #v3.6.0
22+
go-version: "1.23"
5723

58-
- name: Set up Docker Buildx
59-
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 #v3.10.0
24+
- run: go mod download
25+
- run: go build -o mcp-ui-backend cmd/server/main.go
26+
env:
27+
CGO_ENABLED: 0
6028

61-
- name: Build and push
62-
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 #v6.16.0
29+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
6330
with:
64-
context: .
65-
platforms: linux/amd64,linux/arm64
66-
push: ${{ github.event_name != 'pull_request' }}
67-
tags: ${{ steps.meta.outputs.tags }}
68-
labels: ${{ steps.meta.outputs.labels }}
69-
cache-from: type=gha
70-
cache-to: type=gha,mode=max
71-
72-
# Only for public repositories
73-
# - name: Attest
74-
# uses: actions/attest-build-provenance@v1
75-
# id: attest
76-
# with:
77-
# subject-name: ghcr.io/${{ github.repository }}
78-
# subject-digest: ${{ steps.push.outputs.digest }}
79-
# push-to-registry: true
31+
name: mcp-ui-backend-binary
32+
path: mcp-ui-backend
33+
if-no-files-found: error

.github/workflows/on-pr.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: On Pull Request
2+
permissions:
3+
contents: read
4+
on:
5+
pull_request:
6+
types:
7+
- opened
8+
- synchronize
9+
10+
jobs:
11+
build:
12+
uses: ./.github/workflows/build.yaml

.github/workflows/on-release.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
nextVersion:
7+
description: "specify the release version in the semver format v[major].[minor].[patch] e.g. v0.0.0"
8+
required: true
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
REGISTRY: ghcr.io/openmcp-project
15+
IMAGE_NAME: mcp-ui-backend
16+
17+
jobs:
18+
release:
19+
runs-on: ubuntu-latest
20+
needs:
21+
- run-build
22+
permissions:
23+
contents: write
24+
packages: write
25+
id-token: write
26+
attestations: write
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
fetch-depth: 0 # Fetch all history for all tags and branches
33+
34+
- name: Check if tag already exists
35+
id: check_tag
36+
run: |
37+
if git rev-parse ${{ github.event.inputs.nextVersion }} >/dev/null 2>&1
38+
then
39+
echo "Tag ${{ github.event.inputs.nextVersion }} already exists."
40+
exit 1
41+
else
42+
echo "Tag does not exit. Building release version ${{ github.event.inputs.nextVersion }}"
43+
fi
44+
45+
- name: Log in to the Container registry
46+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
47+
with:
48+
registry: ${{ env.REGISTRY }}
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Set up QEMU
53+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 #v3.6.0
54+
55+
- name: Set up Docker Buildx
56+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 #v3.10.0
57+
58+
- name: Build and push
59+
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 #v6.16.0
60+
with:
61+
context: .
62+
platforms: linux/amd64,linux/arm64
63+
push: true
64+
sbom: true
65+
provenance: mode=max
66+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.nextVersion }}
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max
69+
70+
- name: Create Release with autogenerated release notes
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
run: |
74+
gh release create ${{ github.event.inputs.nextVersion }} \
75+
--generate-notes \
76+
--target ${{ github.sha }}

0 commit comments

Comments
 (0)