Merge pull request #9 from soerenschneider/dependabot/go_modules/gith… #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Create and publish a container | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: {} | |
env: | |
GH_REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
permissions: | |
packages: write | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the gcr registry | |
uses: docker/login-action@v3.3.0 | |
with: | |
registry: ${{ env.GH_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for container | |
id: gcr | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: ${{ env.GH_REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value={{ branch}}-{{date 'YYYYMMDDHHmmss'}} | |
type=ref,event=branch | |
type=ref,event=pr | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push container image | |
uses: docker/build-push-action@v6.9.0 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.gcr.outputs.tags }} | |
labels: ${{ steps.gcr.outputs.labels }} |