Skip to content

fix: update workflow #21

fix: update workflow

fix: update workflow #21

Workflow file for this run

name: Docker Build and Deploy Image
on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'
jobs:
deploy:
name: Build and Deploy Image
runs-on: ubuntu-latest
env:
DOCKER_REPO_NAME: binarypatrick/header-audit
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set Tag Variable
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
echo "DOCKER_IMAGE_TAGS=${{ env.DOCKER_REPO_NAME }}:${GITHUB_REF#refs/*/}, $DOCKER_REPO_NAME:latest" >> "$GITHUB_ENV"
- name: Set Tag Variable
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
run: |
echo "DOCKER_IMAGE_TAGS=${{ env.DOCKER_REPO_NAME }}:${{ github.sha }}" >> "$GITHUB_ENV"
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build and Push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.DOCKER_IMAGE_TAGS }}