Skip to content

Commit 9639dcb

Browse files
committed
update workflow
1 parent ce081d4 commit 9639dcb

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

.github/workflows/build-deploy.yaml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,37 @@ on:
77
- 'v*.*.*'
88

99
jobs:
10-
build:
11-
name: Build Docker image and push to repositories
10+
deploy-tagged:
11+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
12+
name: Tagged release deploy
1213
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Set Tag Variable
19+
id: vars
20+
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
1321

22+
- name: Login to Dockerhub
23+
uses: docker/login-action@v2
24+
with:
25+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
26+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
27+
28+
- name: Build and Push
29+
uses: docker/build-push-action@v4
30+
with:
31+
context: .
32+
push: true
33+
tags: |
34+
binarypatrick/header-audit:latest
35+
binarypatrick/header-audit:${{ steps.vars.outputs.tag }}
36+
37+
deploy-untagged:
38+
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
39+
name: Tagged release deploy
40+
runs-on: ubuntu-latest
1441
steps:
1542
- name: Checkout code
1643
uses: actions/checkout@v3
@@ -26,9 +53,8 @@ jobs:
2653
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
2754

2855
- name: Build and Push
29-
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
3056
uses: docker/build-push-action@v4
3157
with:
3258
context: .
3359
push: true
34-
tags: ${{ github.sha }}
60+
tags: binarypatrick/header-audit:${{ github.sha }}

0 commit comments

Comments
 (0)