Skip to content

Commit eb9c1a2

Browse files
committed
feat: add support for Docker image tags in build workflow
1 parent 16c3447 commit eb9c1a2

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

‎.github/workflows/build-image.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
required: true
88
type: string
99
description: "Docker image name (e.g., ctrlplane/api)"
10+
tags:
11+
required: false
12+
type: string
13+
description: "Tags for the Docker image"
1014
dockerfile:
1115
required: true
1216
type: string
@@ -63,6 +67,7 @@ jobs:
6367
images: ${{ inputs.image-name }}
6468
tags: |
6569
type=sha,format=short,prefix=
70+
${{ inputs.tags }}
6671
6772
- name: Build
6873
uses: docker/build-push-action@v6

‎.github/workflows/release.yaml‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release:
14+
name: Release
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Go
23+
uses: actions/setup-go@v4
24+
with:
25+
go-version: "1.25"
26+
27+
- name: Release
28+
id: semantic-release
29+
uses: googleapis/release-please-action@v4
30+
with:
31+
release-type: simple
32+
token: ${{ secrets.GH_TOKEN }}
33+
34+
- name: Tag Images
35+
if: ${{ steps.semantic-release.outputs.release_created }}
36+
run: |
37+
VERSION=${{ steps.semantic-release.outputs.tag_name }}
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
40+
41+
build-app:
42+
name: Build API App
43+
44+
needs: release
45+
if: ${{ needs.release.outputs.release_created }}
46+
47+
uses: ./.github/workflows/build-image.yaml
48+
secrets: inherit
49+
50+
with:
51+
image-name: ctrlplane/api
52+
dockerfile: apps/api/Dockerfile
53+
platform: "linux/amd64"
54+
tags: |
55+
type=semver,pattern={{version}},value=${{ needs.release.outputs.tag_name }}
56+
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release.outputs.tag_name }}
57+
type=semver,pattern={{major}},value=${{ needs.release.outputs.tag_name }}
58+
type=raw,value=latest
59+
60+
build-web:
61+
name: Build Web App
62+
63+
needs: release
64+
if: ${{ needs.release.outputs.release_created }}
65+
66+
uses: ./.github/workflows/build-image.yaml
67+
secrets: inherit
68+
69+
with:
70+
image-name: ctrlplane/web
71+
dockerfile: apps/web/Dockerfile
72+
platform: "linux/amd64"
73+
tags: |
74+
type=semver,pattern={{version}},value=${{ needs.release.outputs.tag_name }}
75+
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release.outputs.tag_name }}
76+
type=semver,pattern={{major}},value=${{ needs.release.outputs.tag_name }}
77+
type=raw,value=latest
78+
79+
build-workspace-engine:
80+
name: Build Workspace Engine
81+
82+
needs: release
83+
if: ${{ needs.release.outputs.release_created }}
84+
85+
uses: ./.github/workflows/build-image.yaml
86+
secrets: inherit
87+
88+
with:
89+
image-name: ctrlplane/workspace-engine
90+
dockerfile: apps/workspace-engine/Dockerfile
91+
platform: "linux/amd64"
92+
tags: |
93+
type=semver,pattern={{version}},value=${{ needs.release.outputs.tag_name }}
94+
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release.outputs.tag_name }}
95+
type=semver,pattern={{major}},value=${{ needs.release.outputs.tag_name }}
96+
type=raw,value=latest

0 commit comments

Comments
 (0)