Skip to content

Refactor Docker workflow for improved structure #7

Refactor Docker workflow for improved structure

Refactor Docker workflow for improved structure #7

Workflow file for this run

name: Build and Publish Docker Image (Release)
on:
push:
tags:
- "*.*.*" # Adjust if you use a different tagging scheme
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag name
id: vars
run: |
echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.TAG }}
ghcr.io/${{ github.repository }}:latest