From 8879eb3ef9f6355f92838ebc9d75ed3eb93eb423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=B5=E6=9B=A6?= Date: Mon, 12 Jan 2026 17:02:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=93=E5=8C=85docker=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E5=B9=B6=E4=B8=8A=E4=BC=A0github?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edf77a8..afd3bf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,33 +39,54 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build Docker images (multi-platform) + - name: Build and save Docker image for amd64 uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: linux/amd64 context: . push: false - outputs: type=local,dest=./output - tags: ${{ env.VERSION_TAG }} + load: true + tags: ${{ env.VERSION_TAG }}-amd64 cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:buildcache cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:buildcache,mode=max - - name: Package Docker images + - name: Save amd64 image to tar run: | - cd output - for platform in linux_amd64 linux_arm64 linux_arm_v7; do - platform_name=$(echo $platform | sed 's/_/-/g') - if [ -d "$platform" ]; then - tar -czf ../xiaomusic-${{ github.ref_name }}-${platform_name#linux-}.tar.gz -C $platform . - fi - done - cd .. + docker save ${{ env.VERSION_TAG }}-amd64 -o xiaomusic-${{ github.ref_name }}-amd64.tar + + - name: Build and save Docker image for arm64 + uses: docker/build-push-action@v6 + with: + platforms: linux/arm64 + context: . + push: false + load: true + tags: ${{ env.VERSION_TAG }}-arm64 + cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:buildcache + + - name: Save arm64 image to tar + run: | + docker save ${{ env.VERSION_TAG }}-arm64 -o xiaomusic-${{ github.ref_name }}-arm64.tar + + - name: Build and save Docker image for armv7 + uses: docker/build-push-action@v6 + with: + platforms: linux/arm/v7 + context: . + push: false + load: true + tags: ${{ env.VERSION_TAG }}-armv7 + cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:buildcache + + - name: Save armv7 image to tar + run: | + docker save ${{ env.VERSION_TAG }}-armv7 -o xiaomusic-${{ github.ref_name }}-armv7.tar - name: Upload Docker images as artifacts uses: actions/upload-artifact@v4 with: name: docker-images - path: xiaomusic-*.tar.gz + path: xiaomusic-*.tar retention-days: 1 # Job 推送 Docker 镜像 @@ -150,7 +171,7 @@ jobs: run: | RELEASE_NAME=${{ github.ref_name }} - FILES=$(find . -type f -name "xiaomusic-*.tar.gz") + FILES=$(find . -type f -name "xiaomusic-*.tar") for FILE in ${FILES}; do echo "type upload ${FILE}" gh release upload "${RELEASE_NAME}" "${FILE}" --clobber