Skip to content

Update publish-docker-image.yml #11

Update publish-docker-image.yml

Update publish-docker-image.yml #11

name: Publish Docker Image to GHCR
on:
push:
paths:
- 'Dockerfile'
- '.github/workflows/publish-docker-image.yml'
workflow_dispatch:
# Triggered by a repository_dispatch event to allow external systems to initiate the workflow
repository_dispatch:
types: [publish-docker-image]
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image with version tag
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/yourip:${{ github.event.client_payload.tag }}
ghcr.io/${{ github.repository_owner }}/yourip:latest
- name: Build and push Docker image with nightly tag
if: github.event.client_payload.tag == 'nightly'
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/yourip:nightly
- name: Logout from GHCR
run: docker logout ghcr.io