Skip to content

Commit

Permalink
ci: add publish-image.yml
Browse files Browse the repository at this point in the history
Replaces functionality that was previously
included in review.yml.
  • Loading branch information
danipran committed Apr 19, 2024
1 parent 0e523c8 commit 5072807
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and publish a container image

on:
push:
branches: [ "main" ]
# pull_request:
# branches: [ "main" ]

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 into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.GHCR_CONTAINER_REGISTRY_USER }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Extract Container metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and publish container image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 5072807

Please sign in to comment.