2020-12-26 15:49:24 +01:00
|
|
|
name: Publish Docker Image
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2023-04-01 08:45:50 +02:00
|
|
|
- main
|
2023-04-01 08:46:37 +02:00
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
2020-12-26 15:49:24 +01:00
|
|
|
jobs:
|
2023-04-01 08:46:37 +02:00
|
|
|
build-and-push-image:
|
2020-12-26 15:49:24 +01:00
|
|
|
runs-on: ubuntu-latest
|
2023-04-01 08:46:37 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
2020-12-26 15:49:24 +01:00
|
|
|
steps:
|
2023-04-01 08:46:37 +02:00
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Extract Docker metadata
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
tags: |
|
|
|
|
type=raw,value={{date 'YYYYMMDD'}}-{{sha}}
|
|
|
|
type=raw,value={{date 'YYYYMMDD'}}
|
|
|
|
type=raw,value=latest
|
|
|
|
- name: Log into registry ${{ env.REGISTRY }}
|
|
|
|
uses: docker/login-action@v2.1.0
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.CI_PAT_WRITE_PACKAGE }}
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
push: true
|