Skip to content

Commit

Permalink
fix release job in gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
groundnuty committed Sep 3, 2022
1 parent 3595d7c commit 4b8fe15
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ name: Build and Deploy

on:
push:
branches: [ "master"]
branches: ["master"]
# Publish semver tags as releases.
tags: [ "v*.*.*" ]
pull_request:
branches: [ "master"]
branches: ["master"]
release:
types: ["created"]
workflow_dispatch:
inputs: {}

Expand Down Expand Up @@ -62,7 +64,22 @@ jobs:
deploy:
needs: [ "scan" ]
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/v')
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- uses: actions/checkout@v2
- run: make push
with:
# Need tags for Makefile logic to work
fetch-depth: 0
- name: Build and Push Docker Images
run: make push

0 comments on commit 4b8fe15

Please sign in to comment.