ci: Push to ghcr instead of DockerHub for custom tags

This commit is contained in:
TwiN 2025-04-01 18:28:07 -04:00 committed by GitHub
parent 76a8710e0b
commit c9c2639f67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,17 +16,18 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Get image repository - name: Get image repository
run: echo IMAGE_REPOSITORY=$(echo ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV run: echo GHCR_IMAGE_REPOSITORY=$(echo ghcr.io/${{ github.actor }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Login to Docker Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} registry: ghcr.io
password: ${{ secrets.DOCKER_PASSWORD }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: ${{ env.IMAGE_REPOSITORY }} images: ${{ env.GHCR_IMAGE_REPOSITORY }}
tags: | tags: |
type=raw,value=${{ inputs.tag }} type=raw,value=${{ inputs.tag }}
- name: Build and push Docker image - name: Build and push Docker image