Skip to content

Commit

Permalink
build on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
emmpaul committed Sep 17, 2024
1 parent 8ea2ec7 commit 9d7050c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/docker-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Build and Push Docker Image

on:
push:
branches:
- master
tags:
- 'v*.*.*'

jobs:
build:
Expand All @@ -20,11 +20,15 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Extract tag name
id: extract_tag
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Build Docker image
run: |
docker build -t flask-json-ui:latest -f Dockerfile .
docker build -t flask-json-ui:${{ env.TAG_NAME }} -f Dockerfile .
- name: Tag and push Docker image
run: |
docker tag flask-json-ui:latest ghcr.io/networkpaul/json-route-app/flask-json-ui:latest
docker push ghcr.io/networkpaul/json-route-app/flask-json-ui:latest
docker tag flask-json-ui:${{ env.TAG_NAME }} ghcr.io/networkpaul/json-route-app/flask-json-ui:${{ env.TAG_NAME }}
docker push ghcr.io/networkpaul/json-route-app/flask-json-ui:${{ env.TAG_NAME }}

0 comments on commit 9d7050c

Please sign in to comment.