Skip to content

feat: Automatic image build & push #1

feat: Automatic image build & push

feat: Automatic image build & push #1

Workflow file for this run

name: build-container.yml
on:
push:
tags:
- '*.*.*'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Extract tag name
id: meta
run: |
TAG=${GITHUB_REF#refs/tags/}
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image name
id: image
run: |
IMAGE=ghcr.io/${{ github.repository }}
echo "image=$IMAGE" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v7
with:
push: true
tags: ${{ steps.image.outputs.image }}:latest, ${{ steps.image.outputs.image }}:${{ steps.meta.outputs.tag }}