Skip to content

Commit da033f5

Browse files
committed
run only on tags
1 parent f771c1b commit da033f5

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

.github/workflows/docker-build.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: ci
22

33
on:
44
push:
5-
branches: [ "main" ]
6-
tags: [ "*" ]
5+
tags:
6+
- '*' # Runs only when a tag is pushed
77

88
jobs:
99
build:
@@ -19,31 +19,20 @@ jobs:
1919
remove-android: 'true'
2020
remove-haskell: 'true'
2121
remove-codeql: 'true'
22-
remove-docker-images: 'true'
23-
overprovision-lvm: 'true'
2422

2523
- uses: actions/checkout@v4
26-
- name: Inspect Disk Space
27-
run: df -h
28-
- name: Prune Docker
29-
run: docker system prune -af
30-
- uses: actions/checkout@v4
31-
32-
- name: Set image tag
33-
id: vars
34-
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
3524

3625
- name: Login to Docker Hub
3726
run: echo "${{ secrets.GH_DOCKERHUB }}" | docker login -u fnzv --password-stdin
3827

39-
- name: Build image
28+
- name: Build and Push image
4029
run: |
30+
TAG_NAME=${{ github.ref_name }}
31+
4132
docker build \
42-
-t fnzv/trash:${{ steps.vars.outputs.SHORT_SHA }} \
33+
-t fnzv/trash:${TAG_NAME} \
4334
-t fnzv/trash:latest \
4435
.
45-
46-
- name: Push image
47-
run: |
48-
docker push fnzv/trash:${{ steps.vars.outputs.SHORT_SHA }}
49-
docker push fnzv/trash:latest
36+
37+
docker push fnzv/trash:${TAG_NAME}
38+
docker push fnzv/trash:latest

0 commit comments

Comments
 (0)