Skip to content

Commit 4b8fe15

Browse files
committed
fix release job in gh actions
1 parent 3595d7c commit 4b8fe15

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/build-and-publish.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ name: Build and Deploy
22

33
on:
44
push:
5-
branches: [ "master"]
5+
branches: ["master"]
66
# Publish semver tags as releases.
77
tags: [ "v*.*.*" ]
88
pull_request:
9-
branches: [ "master"]
9+
branches: ["master"]
10+
release:
11+
types: ["created"]
1012
workflow_dispatch:
1113
inputs: {}
1214

@@ -62,7 +64,22 @@ jobs:
6264
deploy:
6365
needs: [ "scan" ]
6466
runs-on: ubuntu-20.04
65-
if: startsWith(github.ref, 'refs/tags/v')
67+
if: github.event_name == 'release' && github.event.action == 'created'
6668
steps:
69+
- name: Login to Docker Hub
70+
uses: docker/login-action@v2
71+
with:
72+
username: ${{ secrets.DOCKERHUB_USERNAME }}
73+
password: ${{ secrets.DOCKERHUB_TOKEN }}
74+
- name: Login to GitHub Container Registry
75+
uses: docker/login-action@v2
76+
with:
77+
registry: ghcr.io
78+
username: ${{ github.actor }}
79+
password: ${{ secrets.GHCR_TOKEN }}
6780
- uses: actions/checkout@v2
68-
- run: make push
81+
with:
82+
# Need tags for Makefile logic to work
83+
fetch-depth: 0
84+
- name: Build and Push Docker Images
85+
run: make push

0 commit comments

Comments
 (0)