From fe88919d4871193dab97643c4faad03a5cc35304 Mon Sep 17 00:00:00 2001 From: Clivia <132346501+Yanyutin753@users.noreply.github.com> Date: Sat, 16 Mar 2024 13:51:57 +0000 Subject: [PATCH] fix docker-image --- .github/workflows/docker-image-amd64.yml | 66 +++++++++++++++--------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/.github/workflows/docker-image-amd64.yml b/.github/workflows/docker-image-amd64.yml index df43f433..2079d31f 100644 --- a/.github/workflows/docker-image-amd64.yml +++ b/.github/workflows/docker-image-amd64.yml @@ -1,45 +1,61 @@ -name: Publish Docker Image +name: Publish Docker image (amd64) on: + push: + tags: + - '*' workflow_dispatch: - release: - types: [published] - + inputs: + name: + description: 'reason' + required: false jobs: - push_to_registry: - name: Push Docker image to Docker Hub + push_to_registries: + name: Push Docker image to multiple registries runs-on: ubuntu-latest + permissions: + packages: write + contents: read steps: - 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 - uses: docker/login-action@v3 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} 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 id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@v4 with: - images: yangclivia/one-api - tags: | - type=raw,value=latest - type=ref,event=tag + images: | + justsong/one-api + ghcr.io/${{ github.repository }} - - name: Set up QEMU - 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 + - name: Build and push Docker images + uses: docker/build-push-action@v3 with: context: . - platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file