Skip to content

Commit ddace15

Browse files
committed
ADD: Job to deliver image
1 parent 7258876 commit ddace15

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Diff for: .github/workflows/docker-image.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
fail_ci_if_error: true
3939

4040
build:
41-
if: github.ref == 'refs/heads/main'
41+
if: startsWith(github.ref, 'refs/tags/')
4242
runs-on: ubuntu-latest
4343
needs: coverage
4444
steps:
@@ -53,11 +53,16 @@ jobs:
5353
- name: Add SHORT_SHA env property with commit short sha
5454
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
5555

56+
- name: Docker Tag
57+
id: vars
58+
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
59+
5660
- name: Build the Docker image
57-
run: docker build . --file Dockerfile --tag jarpsimoes/git_http_server:v0.${SHORT_SHA}
61+
run: |
62+
docker build . --file Dockerfile --tag jarpsimoes/git_http_server:${{ steps.vars.outputs.tag }}
63+
docker tag jarpsimoes/git_http_server:${{ steps.vars.outputs.tag }} jarpsimoes/git_http_server:latest
5864
5965
- name: Push Image
60-
run: docker push jarpsimoes/git_http_server:v0.${SHORT_SHA}
61-
62-
- name: Push Latest
63-
run: docker tag jarpsimoes/git_http_server:v0.${SHORT_SHA} jarpsimoes/git_http_server:latest && docker push jarpsimoes/git_http_server:latest
66+
run: |
67+
docker push jarpsimoes/git_http_server:${{ steps.vars.outputs.tag }}
68+
docker push jarpsimoes/git_http_server:latest

0 commit comments

Comments
 (0)