name: Build & Push Docker to GHCR (Lite) on: push: branches: [Lite] tags: ['v*'] workflow_dispatch: env: REGISTRY: ghcr.io # 推仓库自己的 GHCR 包(github.repository = Furrium/forumlify)—— # 仓库 GITHUB_TOKEN 无权推跨仓库包(如 lezi-fun/forumlify-deploy) IMAGE_NAME: ${{ github.repository }} jobs: build: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GHCR uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | # Lite 分支 → lite 标签(与 next 镜像隔离,避免覆盖) type=raw,value=lite,enable=${{ github.ref == 'refs/heads/Lite' }} type=semver,pattern={{version}} type=sha,prefix=git- - name: Build and push (linux/amd64 + linux/arm64) uses: docker/build-push-action@v6 with: context: . push: true platforms: linux/amd64, linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max