Skip to content

Commit 31fcef6

Browse files
committed
Update CI to use matrix for builds, docker/metadata action for versioning
1 parent e3ef232 commit 31fcef6

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55

66
env:
77
GO_VERSION: 1.23.6
8-
REGISTRY: quay.io
98

109
jobs:
1110
test:
@@ -28,45 +27,50 @@ jobs:
2827
with:
2928
version: v1.60
3029
deploy:
31-
runs-on: ubuntu-latest
3230
needs: test
33-
if: ${{ success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-')) }}
31+
if: ${{ success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/v')) }}
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
include:
37+
- dockerfile: ./images/perf/Dockerfile
38+
image: quay.io/tigeradev/tiger-bench-perf
39+
- dockerfile: ./images/nginx/Dockerfile
40+
image: quay.io/tigeradev/tiger-bench-nginx
41+
- dockerfile: ./Dockerfile
42+
image: quay.io/tigeradev/tiger-bench
43+
permissions:
44+
contents: read
45+
packages: write
3446
steps:
3547
- name: Checkout
3648
uses: actions/checkout@v4
37-
- name: Set BRANCH to branch name
38-
run: echo "BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/[^a-zA-Z0-9]/-/g')" >> $GITHUB_ENV
39-
- name: Login to Docker Hub
49+
- name: Login to quay.io
4050
uses: docker/login-action@v3
4151
with:
4252
registry: quay.io
4353
username: ${{ vars.QUAY_USERNAME }}
4454
password: ${{ secrets.QUAY_TOKEN }}
45-
- name: Set up QEMU
46-
uses: docker/setup-qemu-action@v3
55+
- name: Extract metadata (tags, labels) for Docker
56+
id: meta
57+
uses: docker/metadata-action@v5
58+
with:
59+
images: ${{ matrix.image }}
60+
tags: |
61+
type=ref,event=branch
62+
type=ref,event=pr
63+
type=semver,pattern=v{{version}}
4764
- name: Set up Docker Buildx
4865
uses: docker/setup-buildx-action@v3
49-
- name: Build and push tiger-bench
66+
67+
- name: Build and push Docker images for tiger-bench
5068
uses: docker/build-push-action@v6
5169
with:
5270
build-args: |
5371
GO_VERSION=${{ env.GO_VERSION }}
5472
context: .
73+
file: ${{ matrix.dockerfile }}
5574
push: true
56-
tags: ${{ env.REGISTRY }}/tigeradev/tiger-bench:${{ env.BRANCH }}
57-
- name: Build and push nginx
58-
uses: docker/build-push-action@v6
59-
with:
60-
build-args: |
61-
GO_VERSION=${{ env.GO_VERSION }}
62-
context: images/nginx/
63-
push: true
64-
tags: ${{ env.REGISTRY }}/tigeradev/tiger-bench-nginx:${{ env.BRANCH }}
65-
- name: Build and push perf
66-
uses: docker/build-push-action@v6
67-
with:
68-
build-args: |
69-
GO_VERSION=${{ env.GO_VERSION }}
70-
context: images/perf/
71-
push: true
72-
tags: ${{ env.REGISTRY }}/tigeradev/tiger-bench-perf:${{ env.BRANCH }}
75+
tags: ${{ steps.meta.outputs.tags }}
76+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)