fix docker-image
This commit is contained in:
parent
0968cf6cf7
commit
fe88919d48
64
.github/workflows/docker-image-amd64.yml
vendored
64
.github/workflows/docker-image-amd64.yml
vendored
@ -1,45 +1,61 @@
|
|||||||
name: Publish Docker Image
|
name: Publish Docker image (amd64)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
release:
|
inputs:
|
||||||
types: [published]
|
name:
|
||||||
|
description: 'reason'
|
||||||
|
required: false
|
||||||
jobs:
|
jobs:
|
||||||
push_to_registry:
|
push_to_registries:
|
||||||
name: Push Docker image to Docker Hub
|
name: Push Docker image to multiple registries
|
||||||
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@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- 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@v3
|
uses: docker/login-action@v2
|
||||||
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@v5
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: yangclivia/one-api
|
images: |
|
||||||
tags: |
|
justsong/one-api
|
||||||
type=raw,value=latest
|
ghcr.io/${{ github.repository }}
|
||||||
type=ref,event=tag
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Build and push Docker images
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/build-push-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
|
|
||||||
|
Loading…
Reference in New Issue
Block a user