Skip to content

Commit 1229819

Browse files
committed
ci: use release-please
Signed-off-by: Peter Balogh <poke@riptides.io>
1 parent 87f0f08 commit 1229819

File tree

7 files changed

+196
-49
lines changed

7 files changed

+196
-49
lines changed

.github/release-config.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,54 @@
88
"helm-chart": {
99
"package-name": "helm",
1010
"release-type": "helm"
11+
},
12+
"src/adservice": {
13+
"package-name": "image-adservice",
14+
"release-type": "simple"
15+
},
16+
"src/cartservice": {
17+
"package-name": "image-cartservice",
18+
"release-type": "simple"
19+
},
20+
"src/checkoutservice": {
21+
"package-name": "image-checkoutservice",
22+
"release-type": "simple"
23+
},
24+
"src/currencyservice": {
25+
"package-name": "image-currencyservice",
26+
"release-type": "simple"
27+
},
28+
"src/emailservice": {
29+
"package-name": "image-emailservice",
30+
"release-type": "simple"
31+
},
32+
"src/frontend": {
33+
"package-name": "image-frontend",
34+
"release-type": "simple"
35+
},
36+
"src/loadgenerator": {
37+
"package-name": "image-loadgenerator",
38+
"release-type": "simple"
39+
},
40+
"src/paymentservice": {
41+
"package-name": "image-paymentservice",
42+
"release-type": "simple"
43+
},
44+
"src/productcatalogservice": {
45+
"package-name": "image-productcatalogservice",
46+
"release-type": "simple"
47+
},
48+
"src/recommendationservice": {
49+
"package-name": "image-recommendationservice",
50+
"release-type": "simple"
51+
},
52+
"src/shippingservice": {
53+
"package-name": "image-shippingservice",
54+
"release-type": "simple"
55+
},
56+
"src/shoppingassistantservice": {
57+
"package-name": "image-shoppingassistantservice",
58+
"release-type": "simple"
1159
}
1260
}
1361
}

.github/release-manifest.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
{
2-
"helm-chart": "0.10.6"
2+
"helm-chart": "0.10.6",
3+
"src/adservice": "0.0.1",
4+
"src/cartservice": "0.0.1",
5+
"src/checkoutservice": "0.0.1",
6+
"src/currencyservice": "0.0.1",
7+
"src/emailservice": "0.0.1",
8+
"src/frontend": "0.0.1",
9+
"src/loadgenerator": "0.0.1",
10+
"src/paymentservice": "0.0.1",
11+
"src/productcatalogservice": "0.0.1",
12+
"src/recommendationservice": "0.0.1",
13+
"src/shippingservice": "0.0.1",
14+
"src/shoppingassistantservice": "0.0.1"
315
}

.github/workflows/docker-build-push.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/helm-lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v5
1818
with:
1919
fetch-depth: 0
2020

.github/workflows/helm-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v5
2525
with:
2626
fetch-depth: 0
2727

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: ci-release-images
2+
3+
on:
4+
push:
5+
tags:
6+
- 'image-*-v*'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11+
12+
jobs:
13+
prepare-build:
14+
name: Prepare Build
15+
outputs:
16+
targets: ${{ steps.all-targets.outputs.targets }}
17+
image-tag: ${{ steps.resolve.outputs.version }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v5
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Filter target
26+
id: resolve
27+
run: |
28+
# This assumes tags are in this form
29+
# image-<component1>-<component2>-v<version>
30+
31+
# strip image- prefix from the tag
32+
_target=${GITHUB_REF_NAME#image}
33+
34+
# remove version to only get the component
35+
target=${_target%-v*}
36+
37+
# remove the - from the beginning of the target if it exists
38+
target=${target#-}
39+
40+
# get version only
41+
version=${_target##*-v}
42+
43+
# set target and version as output
44+
echo target=${target} >> ${GITHUB_OUTPUT}
45+
echo version=${version} >> ${GITHUB_OUTPUT}
46+
47+
# Print the target and version
48+
echo "Target: $target"
49+
echo "Version: $version"
50+
51+
- name: List all targets
52+
id: all-targets
53+
uses: docker/bake-action/subaction/list-targets@v6
54+
with:
55+
target: ${{ steps.resolve.outputs.target }}
56+
continue-on-error: true
57+
58+
build-push:
59+
name: Build docker image - ${{ matrix.target }}
60+
needs: [prepare-build]
61+
if: ${{ needs.prepare-build.outputs.targets != '[]' && needs.prepare-build.outputs.targets != '' }}
62+
strategy:
63+
fail-fast: false
64+
matrix:
65+
target: ${{ fromJson(needs.prepare-build.outputs.targets) }}
66+
uses: ./.github/workflows/reusable-docker-build-push.yml
67+
permissions:
68+
contents: 'read'
69+
packages: 'write'
70+
attestations: 'write'
71+
with:
72+
bake-targets: ${{ matrix.target }}
73+
image-tag: ${{ needs.prepare-build.outputs.image-tag }}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and Push
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
bake-targets:
7+
required: true
8+
type: string
9+
description: "Bake target"
10+
bake-file:
11+
required: false
12+
type: string
13+
description: "Bake file"
14+
default: "docker-bake.hcl"
15+
image-tag:
16+
required: true
17+
type: string
18+
description: "Image tag to use."
19+
image-repo:
20+
required: false
21+
type: string
22+
description: "Image repo to use."
23+
default: "ghcr.io/riptideslabs/microservices-demo"
24+
25+
jobs:
26+
build-and-push:
27+
name: Build and Push
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v5
33+
with:
34+
fetch-depth: 0
35+
36+
- name: Login to GitHub Container Registry
37+
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
38+
uses: docker/login-action@v3
39+
with:
40+
registry: ghcr.io
41+
username: ${{github.actor}}
42+
password: ${{github.token}}
43+
44+
- name: Setup QEMU
45+
uses: docker/setup-qemu-action@v3
46+
47+
- name: Setup Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
50+
- name: Build and push
51+
uses: docker/bake-action@v6
52+
env:
53+
IMAGE_REPO: ${{ inputs.image-repo }}
54+
IMAGE_TAG: ${{ inputs.image-tag }}
55+
with:
56+
files: |
57+
${{ inputs.bake-file }}
58+
targets: ${{ inputs.bake-targets }}
59+
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
60+
provenance: false

0 commit comments

Comments
 (0)