diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml deleted file mode 100644 index 5bafea0..0000000 --- a/.github/workflows/debug.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: debug - -on: - workflow_dispatch: - -jobs: - publish-dockerhub: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Get artifacts - run: | - bash get_artifacts.sh ${{ secrets.GITHUB_TOKEN }} $(curl "https://api.github.com/repos/NapNeko/NapCatQQ/releases/latest" | jq -r '.tag_name') - - name: Set up Docker buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Run buildx and push - env: - DOCKER_REPO: mlikiowa/napcat-docker - GITHUB_REPO: NapNeko/NapCatQQ - run: | - TAG=$(curl "https://api.github.com/repos/NapNeko/NapCatQQ/releases/latest" | jq -r '.tag_name') - docker buildx build \ - --build-arg LINK=$LINK \ - --output "type=image,push=true" \ - --platform linux/amd64,linux/arm64 \ - --tag ${DOCKER_REPO}:$TAG \ - --tag ${DOCKER_REPO}:latest-test \ - --file ./Dockerfile \ - . - - name: Docker Hub logout - if: always() - run: docker logout \ No newline at end of file diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 68472f9..1d0d71d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,119 +1,38 @@ -name: ci +name: docker-publish on: workflow_dispatch: - # push: - # branches: - # - "main" - -env: - REGISTRY_IMAGE: mlikiowa/napcat-docker jobs: - build: + publish-dockerhub: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - platform: - - linux/amd64 - - linux/arm64 steps: - - - name: Prepare - run: | - platform=${{ matrix.platform }} - echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - - - name: Checkout + - name: Checkout uses: actions/checkout@v4 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY_IMAGE }} - tags: | - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx + - name: Get artifacts + run: | + bash get_artifacts.sh ${{ secrets.GITHUB_TOKEN }} $(curl "https://api.github.com/repos/NapNeko/NapCatQQ/releases/latest" | jq -r '.tag_name') + - name: Set up Docker buildx uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Get artifacts + # Fork from https://github.com/koishijs/boilerplate/blob/master/.github/workflows/docker.yml + - name: Run buildx and push env: - ARCH_NC: ${{ matrix.platform }} + DOCKER_REPO: mlikiowa/napcat-docker + GITHUB_REPO: NapNeko/NapCatQQ run: | - bash get_artifacts.sh ${{ secrets.GITHUB_TOKEN }} - ls -lh - - - name: Build and push by digest - id: build - uses: docker/build-push-action@v5 - with: - context: . - platforms: ${{ matrix.platform }} - labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true - - - name: Export digest - run: | - mkdir -p /tmp/digests - digest="${{ steps.build.outputs.digest }}" - touch "/tmp/digests/${digest#sha256:}" - - - name: Upload digest - uses: actions/upload-artifact@v4 - with: - name: digests-${{ env.PLATFORM_PAIR }} - path: /tmp/digests/* - if-no-files-found: error - retention-days: 1 - - merge: - runs-on: ubuntu-latest - needs: - - build - steps: - - - name: Download digests - uses: actions/download-artifact@v4 - with: - path: /tmp/digests - pattern: digests-* - merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY_IMAGE }} - tags: | - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_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 ' *) - - - name: Inspect image - run: | - docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} \ No newline at end of file + TAG=$(curl "https://api.github.com/repos/NapNeko/NapCatQQ/releases/latest" | jq -r '.tag_name') + docker buildx build \ + --output "type=image,push=true" \ + --platform linux/amd64,linux/arm64 \ + --tag ${DOCKER_REPO}:$TAG \ + --tag ${DOCKER_REPO}:latest \ + --file ./Dockerfile \ + . + - name: Docker Hub logout + if: always() + run: docker logout \ No newline at end of file