Skip to content

Commit

Permalink
GH Action to publish updated image
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Nov 17, 2023
1 parent eec1237 commit 4e0ccd2
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Docker Image CI

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

env:
THIS: "ebullient/pandoc-emoji"
TAG: "3.1"

jobs:

build:
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=schedule,pattern={{date 'YYYYMMDD'}}
type=raw,value=latest,enable={{is_default_branch}}
type=raw,enable=true,priority=200,prefix=,suffix=,value=${{ env.TAG }}
- name: Login to Docker Hub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
if: github.repository == ${{ env.THIS }} && github.ref == 'refs/heads/main'
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 4e0ccd2

Please sign in to comment.