ci: push to ghcr.io instead

This commit is contained in:
Larvan2 2023-11-09 23:20:57 +08:00 committed by Steve Johnson
parent 2f203330e4
commit d28c3b50e3

View File

@ -19,7 +19,7 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
env: env:
REGISTRY: docker.io REGISTRY: ghcr.io
jobs: jobs:
Build: Build:
permissions: write-all permissions: write-all
@ -342,24 +342,25 @@ jobs:
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
images: ${{ env.REGISTRY }}/${{ secrets.DOCKERHUB_ACCOUNT }}/${{secrets.DOCKERHUB_REPO}} images: ${{ env.REGISTRY }}/${{ github.repository }}
- name: Show files - name: Show files
run: | run: |
ls . ls .
ls bin/ ls bin/
- name: Log into registry
if: github.event_name != 'pull_request' - name: login to ghcr.io
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: ${{ env.REGISTRY }} registry: ghcr.io
username: ${{ secrets.DOCKER_HUB_USER }} username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
# Build and push Docker image with Buildx (don't push on PR) # Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action # https://github.com/docker/build-push-action
- name: Build and push Docker image - name: Build and push Docker image
id: build-and-push id: build-and-push
uses: docker/build-push-action@v4 uses: docker/build-push-action@v5
with: with:
context: . context: .
file: ./Dockerfile file: ./Dockerfile
@ -367,8 +368,7 @@ jobs:
platforms: | platforms: |
linux/386 linux/386
linux/amd64 linux/amd64
linux/arm64/v8 linux/arm64
linux/arm/v7 linux/arm/v7
# linux/riscv64
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}