Skip to content

Update Docker image build and push action configuration #3

Update Docker image build and push action configuration

Update Docker image build and push action configuration #3

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}:latest
- name: Build and push Docker image with the tag name
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.event.repository.name }}:${{ github.ref_name }}