feat: preinstall acpx #112
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Docker image | |
| on: | |
| push: | |
| branches: ["main", "dev", "oc", "test"] | |
| tags: ["v*.*.*"] | |
| pull_request: | |
| branches: ["main", "dev", "oc", "test"] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| # 阿里云镜像仓库地址 | |
| ALIYUN_REGISTRY: ${{ secrets.ALIYUN_REGISTRY }} | |
| ALIYUN_IMAGE: ${{ secrets.ALIYUN_REGISTRY }}/${{ secrets.ALIYUN_NAMESPACE }}/local_agent | |
| jobs: | |
| push_to_registry: | |
| name: Push Docker image to GHCR and Aliyun | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| # ✅ 登录 GHCR | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # ✅ 登录阿里云容器镜像服务 | |
| - name: Log in to Aliyun Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ secrets.ALIYUN_REGISTRY }} | |
| username: ${{ secrets.ALIYUN_USERNAME }} | |
| password: ${{ secrets.ALIYUN_PASSWORD }} | |
| # ✅ 为 GHCR 提取 metadata | |
| - name: Extract metadata for GHCR | |
| id: meta-ghcr | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=ref,event=tag | |
| type=ref,event=branch | |
| # ✅ 为阿里云提取 metadata | |
| - name: Extract metadata for Aliyun | |
| id: meta-aliyun | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.ALIYUN_IMAGE }} | |
| tags: | | |
| type=ref,event=tag | |
| type=ref,event=branch | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # ✅ 同时推送到 GHCR 和阿里云 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| # 合并两个仓库的 tags | |
| tags: | | |
| ${{ steps.meta-ghcr.outputs.tags }} | |
| ${{ steps.meta-aliyun.outputs.tags }} | |
| labels: ${{ steps.meta-ghcr.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| shm-size: 2g |