Skip to content

Commit

Permalink
Container image publishing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Elliot Blackburn committed May 17, 2024
1 parent 6c46a75 commit 99b4f3b
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Action to build container image and publish to
# GitHub Container Registry (ghcr.io). This runs
# only for pushes to the master branch such as a merge.

name: Package and publish container image

on:
push:
branches:
- master
tags:
- "*"

jobs:
publish:
name: Package and publish container image
runs-on: ubuntu-22.04

steps:
# SHA tag for every push to master
# "edge" tag for every push to master
# semver tag for every tag push matching semver
# latest for the newest tag semver tag push
- name: Generate docker image meta tags
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/bluehatbrit/mdpdf
flavor: |
latest=true
tags: |
type=sha,event=push,branch=$repo.default_branch,prefix=
type=edge,event=push,branch=$repo.default_branch
type=semver,pattern={{version}},prefix=v
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: bluehatbrit
password: ${{ secrets.GITHUB_TOKEN }}

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

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 99b4f3b

Please sign in to comment.