add ghcr.io docker image registery

Added permission to allow writing to the ghcr.io registry
used existing PAT to login to ghcr.io
add ghcr.io to image list.
This commit is contained in:
KingPin 2024-04-09 18:54:03 -04:00 committed by moonrailgun
parent 1dec411dd3
commit 2fe78d8b0f

View File

@ -9,6 +9,9 @@ on:
jobs: jobs:
docker: docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps: steps:
- name: Checkout - name: Checkout
@ -22,7 +25,9 @@ jobs:
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: moonrailgun/tianji images: |
moonrailgun/tianji
ghcr.io/moonrailgun/tianji
tags: | tags: |
type=semver,pattern={{version}} type=semver,pattern={{version}}
- name: Login to DockerHub - name: Login to DockerHub
@ -31,6 +36,13 @@ jobs:
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log into ghcr.io registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Build and push - name: Build and push