Skip to content

Commit 063ebdd

Browse files
authored
CI: build docker image on tag push.
1 parent 7c94910 commit 063ebdd

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

.github/workflows/image.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Build Image
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches:
6-
- develop
7-
6+
tags:
7+
- 'v*'
88
jobs:
99
build_container_and_push:
1010
runs-on: ubuntu-latest
@@ -13,6 +13,15 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v3
1515

16+
- name: Docker meta
17+
id: meta
18+
uses: docker/metadata-action@v4
19+
with:
20+
images: |
21+
ghcr.io/${{ github.repository_owner }}
22+
${{ secrets.DP_HARBOR_REGISTRY }}/dplc
23+
tags: type=semver,pattern={{version}}
24+
1625
- name: Setup Docker Buildx
1726
uses: docker/setup-buildx-action@v1
1827

@@ -33,10 +42,6 @@ jobs:
3342
- name: Build and Push Container
3443
uses: docker/build-push-action@v2
3544
with:
36-
tags: |
37-
ghcr.io/${{ github.repository_owner }}/abacus:latest
38-
${{ secrets.DP_HARBOR_REGISTRY }}/dplc/abacus:latest
45+
tags: ${{ steps.meta.outputs.tags }}
3946
file: Dockerfile
40-
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/abacus:latest
41-
cache-to: type=inline
42-
push: true
47+
push: ${{ github.event_name == 'push' }}

0 commit comments

Comments
 (0)