增加工作流
This commit is contained in:
parent
9fb9b423ec
commit
06c21d8feb
1 changed files with 72 additions and 0 deletions
72
.github/workflows/docker-release.yml
vendored
Normal file
72
.github/workflows/docker-release.yml
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
name: 🐳 Build & Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Image version tag (e.g. v0.2.0, latest)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
GHCR_REGISTRY: ghcr.io
|
||||||
|
GHCR_IMAGE_NAME: ${{ github.repository_owner }}/picoclaw
|
||||||
|
ALIYUN_REGISTRY: registry.cn-beijing.aliyuncs.com
|
||||||
|
ALIYUN_IMAGE_NAME: ${{ secrets.ALIYUN_NAMESPACE }}/picoclaw
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker-build:
|
||||||
|
name: 🏗️ Build Docker Image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# ── Checkout ──────────────────────────────
|
||||||
|
- name: 📥 Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# ── Docker Buildx ─────────────────────────
|
||||||
|
- name: 🔧 Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
# ── Login to GHCR ─────────────────────────
|
||||||
|
- name: 🔑 Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.GHCR_REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# ── Login to Aliyun ───────────────────────
|
||||||
|
- name: 🔑 Login to Aliyun Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.ALIYUN_REGISTRY }}
|
||||||
|
username: ${{ secrets.ALIYUN_USERNAME }}
|
||||||
|
password: ${{ secrets.ALIYUN_PASSWORD }}
|
||||||
|
|
||||||
|
# ── Metadata (tags & labels) ──────────────
|
||||||
|
- name: 🏷️ Prepare image tags
|
||||||
|
id: tags
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
version="${{ inputs.version }}"
|
||||||
|
echo "ghcr_tag=${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${version}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "aliyun_tag=${{ env.ALIYUN_REGISTRY }}/${{ env.ALIYUN_IMAGE_NAME }}:${version}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
# ── Build & Push ──────────────────────────
|
||||||
|
- name: 🚀 Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./docker/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ steps.tags.outputs.ghcr_tag }}
|
||||||
|
${{ steps.tags.outputs.aliyun_tag }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/riscv64
|
||||||
Loading…
Add table
Reference in a new issue