fix(ci): release docker build fails

This commit is contained in:
Neko Ayaka
2025-11-05 00:23:37 +08:00
parent 3caf4aa7d8
commit 9dff810373
+16 -29
View File
@@ -17,43 +17,30 @@ jobs:
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
- name: Fetch version - uses: docker/metadata-action@v5
id: version id: meta
run: |
export LAST_TAGGED_COMMIT=$(git rev-list --tags --max-count=1)
export LAST_TAG=$(git describe --tags $LAST_TAGGED_COMMIT)
echo "version=${LAST_TAG#v}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with: with:
platforms: linux/amd64,linux/arm64,linux/arm64/v8 images: ghcr.io/${{ github.repository }}
flavor: |
- name: Sign in to GitHub Container Registry latest=true
uses: docker/login-action@v3 tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
- name: Create image tags
id: image_tag
run: |
echo "tag_latest=ghcr.io/${{ github.repository }}:latest" >> $GITHUB_OUTPUT
echo "tag=ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
- name: Build and Push
uses: docker/build-push-action@v6
with: with:
context: ./ context: ./
file: ./apps/stage-web/Dockerfile file: ./apps/stage-web/Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/arm64/v8 platforms: linux/amd64,linux/arm64,linux/arm64/v8
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
tags: | push: true
${{ steps.image_tag.outputs.tag_latest }} tags: ${{ steps.meta.outputs.tags }}
${{ steps.image_tag.outputs.tag }} labels: ${{ steps.meta.outputs.labels }}