From b154309a7bd02a442a6078bde3debeb4ab83a54e Mon Sep 17 00:00:00 2001 From: riolurs Date: Sat, 7 Jun 2025 17:22:25 +0800 Subject: [PATCH] Modify Docker config --- .github/workflows/docker.yml | 38 +++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5855e21..ef1a519 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,16 +1,17 @@ name: Publish Docker Image -on: +on: push: branches: [ master ] tags: - '**' -concurrency: +concurrency: group: ${{ github.ref }}-${{ github.workflow }} cancel-in-progress: true env: - REGISTRY_IMAGE: tindy2013/subconverter + REGISTRY_IMAGE: metacubex/subconverter + GHCR_IMAGE: ghcr.io/metacubex/subconverter jobs: build: @@ -32,7 +33,7 @@ jobs: run: | platform=${{ matrix.platform }} echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - + - name: Checkout base uses: actions/checkout@v4 with: @@ -56,6 +57,13 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Get commit SHA if: github.ref == 'refs/heads/master' id: vars @@ -70,7 +78,9 @@ jobs: labels: ${{ steps.meta.outputs.labels }} build-args: | SHA=${{ steps.vars.outputs.sha_short }} - outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true + outputs: | + type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true + type=image,name=${{ env.GHCR_IMAGE }},push-by-digest=true,name-canonical=true,push=true - name: Export digest run: | @@ -106,7 +116,9 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.REGISTRY_IMAGE }} + images: | + ${{ env.REGISTRY_IMAGE }} + ${{ env.GHCR_IMAGE }} tags: | type=semver,pattern={{version}} type=raw,value=latest,enable={{is_default_branch}} @@ -117,12 +129,20 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Create manifest list and push working-directory: /tmp/digests run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) - + docker buildx imagetools create $(jq -cr '.tags | map(select(startswith("${{ env.REGISTRY_IMAGE }}")) | "-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) + docker buildx imagetools create $(jq -cr '.tags | map(select(startswith("${{ env.GHCR_IMAGE }}")) | "-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.GHCR_IMAGE }}@sha256:%s ' *) - name: Inspect image run: | docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}