Update docker-image-amd64.yml

This commit is contained in:
Clivia 2024-03-16 21:48:16 +08:00 committed by GitHub
parent 02a918b149
commit 0968cf6cf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,61 +1,45 @@
name: Publish Docker image (amd64) name: Publish Docker Image
on: on:
push:
tags:
- '*'
workflow_dispatch: workflow_dispatch:
inputs: release:
name: types: [published]
description: 'reason'
required: false
jobs: jobs:
push_to_registries: push_to_registry:
name: Push Docker image to multiple registries name: Push Docker image to Docker Hub
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Check repository URL
run: |
REPO_URL=$(git config --get remote.origin.url)
if [[ $REPO_URL == *"pro" ]]; then
exit 1
fi
- name: Save version info
run: |
git describe --tags > VERSION
- name: Log in to Docker Hub - name: Log in to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker - name: Extract metadata (tags, labels) for Docker
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v5
with: with:
images: | images: yangclivia/one-api
justsong/one-api tags: |
ghcr.io/${{ github.repository }} type=raw,value=latest
type=ref,event=tag
- name: Build and push Docker images - name: Set up QEMU
uses: docker/build-push-action@v3 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max