Skip to content

Commit

Permalink
ci: add deploy-image workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rileychh committed Sep 19, 2024
1 parent 6a964fe commit 776886a
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/deploy-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Create and publish a Docker image

# Publish semver tags as releases.
on:
push:
tags: [ 'v*.*.*' ]

# Defines two custom environment variables for the workflow.
# These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: type=semver,pattern={{version}}

- name: Build and push Docker image
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 776886a

Please sign in to comment.