Skip to content

Commit

Permalink
👷 rebuild docker image. push to gcr
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Oct 10, 2024
1 parent cad0719 commit a6bfd11
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 46 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Docker Image CI

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

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
TAG: "3.1"

jobs:

main-root:
outputs:
is-main: ${{ steps.is-main-root.outputs.test }}
runs-on: ubuntu-latest
steps:
- name: Echo a message
if: github.ref == 'refs/heads/main' && github.repository == 'commonhaus/pandoc-pdf'
id: is-main-root
run: echo "test=true" >> "$GITHUB_OUTPUT"

build:
needs: main-root
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ github.repository }}
tags: |
type=raw,enable=true,priority=200,prefix=,suffix=,value=${{ env.TAG }}
- name: Log in to the Container registry
if: ${{needs.main-root.outputs.is-main}}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


- name: Publish OCI image to GCR
if: ${{needs.main-root.outputs.is-main}}
id: publish-oci
run: |
image="${IMAGE_NAME}:${TAG}"
docker tag "${image}" "ghcr.io/${image}"
docker push "ghcr.io/${image}"
46 changes: 0 additions & 46 deletions .github/workflows/docker-image.yml

This file was deleted.

0 comments on commit a6bfd11

Please sign in to comment.