Skip to content

Merge pull request #878 from edward/patch-1 #132

Merge pull request #878 from edward/patch-1

Merge pull request #878 from edward/patch-1 #132

name: Publish to Docker
on:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
env:
DOCKER_TAG_IMAGE: "ghcr.io/github/pages-gem"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_TAG_IMAGE }}
- name: Build Docker Image
run: |
docker build -t ${{ steps.meta.outputs.tags }} -f Dockerfile .
- name: Push to Container Registry
if: github.event_name != 'pull_request'
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login -u ${{ github.actor }} https://ghcr.io --password-stdin
docker push ${{ steps.meta.outputs.tags }}