Skip to content

Commit 0b8b30f

Browse files
committed
chore(gha): update build workflow
Signed-off-by: Kaan Yagci <[email protected]>
1 parent b2551bb commit 0b8b30f

File tree

1 file changed

+54
-21
lines changed

1 file changed

+54
-21
lines changed

.github/workflows/build.yaml

+54-21
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,58 @@
1-
name: Build Docker image
1+
name: Build and Push Docker Image
2+
23
on:
3-
pull_request:
4-
branches:
5-
- main
6-
types:
7-
- opened
8-
- synchronize
9-
- reopened
10-
# paths:
11-
# - core/*
12-
# - forward-proxy/*
13-
# - Dockerfile
14-
# - Makefile
4+
release:
5+
types:
6+
- published
7+
- edited
8+
9+
pull_request:
10+
branches:
11+
- main
12+
types:
13+
- opened
14+
- synchronize
15+
- reopened
16+
paths:
17+
- core/**
18+
- forward-proxy/**
19+
- Dockerfile
20+
- Makefile
21+
1522
concurrency:
16-
group: "${{ github.workflow_ref }} - ${{ github.ref }} - ${{ github.event_name }}"
17-
cancel-in-progress: true
23+
group: "${{ github.workflow }}-${{ github.ref_name }}-${{ github.event_name }}"
24+
cancel-in-progress: true
25+
1826
jobs:
19-
check-version-changes:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- uses: actions/[email protected]
27+
build-and-push:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
DEBIAN_TAG: ["trixie", "trixie-slim", "bullseye", "bullseye-slim", "buster", "buster-slim", "bookworm-slim", "bookworm"]
32+
steps:
33+
- name: Checkout Repo
34+
uses: actions/[email protected]
35+
36+
- name: Set up Docker Buildx
37+
uses: docker/[email protected]
38+
39+
- name: Login to DockerHub
40+
if: github.event_name == 'release'
41+
uses: docker/[email protected]
42+
with:
43+
username: ${{ secrets.DOCKERHUB_USERNAME }}
44+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
45+
2346

24-
- name: Build the Docker image
25-
run: docker build . -t sfp
47+
- name: Build and Push Docker image
48+
uses: docker/[email protected]
49+
with:
50+
context: .
51+
file: Dockerfile
52+
platforms: linux/amd64,linux/arm64/v8
53+
push: ${{ github.event_name == 'release' }}
54+
tags: makepad/sfp:${{ github.event.release.tag_name }}-${{ matrix.DEBIAN_TAG }}
55+
build-args: |
56+
DEBIAN_TAG=${{ matrix.DEBIAN_TAG }}
57+
cache-from: type=registry,ref=makepad/sfp:${{ github.event.release.tag_name }}-${{ matrix.DEBIAN_TAG }}
58+
cache-to: type=inline

0 commit comments

Comments
 (0)