teabag/.github/workflows/docker-image.yml

42 lines
967 B
YAML
Raw Normal View History

2023-02-05 14:57:16 +01:00
name: build and publish a Docker image
on:
push:
2023-05-07 10:47:04 +02:00
tags:
- 'v*'
2023-02-05 14:57:16 +01:00
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
2023-05-07 10:47:04 +02:00
uses: docker/login-action@v2
2023-02-05 14:57:16 +01:00
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
2023-05-07 10:47:04 +02:00
- name: Extract metadata
2023-02-05 14:57:16 +01:00
id: meta
2023-05-07 10:49:48 +02:00
uses: docker/metadata-action@v4
2023-02-05 14:57:16 +01:00
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
2023-05-07 10:47:04 +02:00
uses: docker/build-push-action@v4
2023-02-05 14:57:16 +01:00
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}