Skip to content

v1.5

v1.5 #8

Workflow file for this run

name: Docker Image CI/CD
on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
release:
types: [published]
env:
REGISTRY: ghcr.io
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set image name lowercase
run: echo "IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Get version from VERSION file
id: get_version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Debug image name
run: |
echo "IMAGE_NAME: ${{ env.IMAGE_NAME }}"
echo "REGISTRY: ${{ env.REGISTRY }}"
echo "Full image path: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
labels: ${{ steps.meta.outputs.labels }}