Skip to content

Commit 6ea5d64

Browse files
authored
Feat/image on push (#119)
1 parent 49491eb commit 6ea5d64

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

.github/workflows/push-rust-services.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
push:
44
tags:
55
- v*
6+
branches:
7+
- main
68
workflow_dispatch:
79
inputs:
810
dispatch_description:
@@ -21,16 +23,6 @@ jobs:
2123
runs-on: ubuntu-latest
2224
steps:
2325
- uses: actions/checkout@v2
24-
- name: Set image tag to version of the git tag
25-
if: ${{ startsWith(github.ref, 'refs/tags/server-v') }}
26-
run: |
27-
PREFIX="refs/tags/server-"
28-
VERSION="${GITHUB_REF:${#PREFIX}}"
29-
echo "IMAGE_TAG=${VERSION}" >> "${GITHUB_ENV}"
30-
- name: Set image tag to the git commit hash
31-
if: ${{ !startsWith(github.ref, 'refs/tags/server-v') }}
32-
run: |
33-
echo "IMAGE_TAG=${{ github.sha }}" >> "${GITHUB_ENV}"
3426
- name: Log in to the Container registry
3527
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
3628
with:
@@ -42,11 +34,17 @@ jobs:
4234
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
4335
with:
4436
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37+
tags: |
38+
type=sha,event=branch
39+
type=ref,event=tag
4540
- name: Extract metadata (tags, labels) for Docker
4641
id: meta_monitor
4742
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
4843
with:
4944
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-monitor
45+
tags: |
46+
type=sha,event=branch
47+
type=ref,event=tag
5048
- name: Build and push server docker image
5149
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
5250
with:

0 commit comments

Comments
 (0)