Skip to content

Commit a611ed0

Browse files
committed
feat: update docker build workflow
1 parent f6e21b7 commit a611ed0

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/docker.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
name: Build and Push Docker Image
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
tags:
8-
- "v*"
4+
workflow_run:
5+
workflows: ["golangci-lint"]
6+
types:
7+
- completed
98

109
jobs:
1110
build-and-push:
1211
runs-on: ubuntu-latest
1312

13+
# Only run if lint workflow succeeded
14+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
15+
1416
permissions:
1517
contents: read
1618
packages: write
1719

1820
steps:
1921
- name: Checkout repository
2022
uses: actions/checkout@v4
23+
with:
24+
# Required when using workflow_run trigger
25+
ref: ${{ github.event.workflow_run.head_sha }}
2126

2227
- name: Set up Docker Buildx
2328
uses: docker/setup-buildx-action@v3
@@ -34,6 +39,10 @@ jobs:
3439
uses: docker/metadata-action@v5
3540
with:
3641
images: ghcr.io/${{ github.repository }}
42+
tags: |
43+
type=sha
44+
type=ref,event=branch
45+
type=raw,value=latest,enable={{is_default_branch}}
3746
3847
- name: Build and push image
3948
uses: docker/build-push-action@v5

0 commit comments

Comments
 (0)