修复 dsh 剥离 KEY 后 CLI 未认证:ensure 时写入实例 CLI profile (#41) #20
Workflow file for this run
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: Release image | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Image version with v prefix, e.g. v0.2.0" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: release-image-${{ github.repository }} | |
| cancel-in-progress: false | |
| env: | |
| DOCKERHUB_IMAGE: docker.io/apecloud/apemind-computer | |
| ACR_REGISTRY: apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com | |
| ACR_IMAGE: apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/apemind-computer | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| ref: ${{ github.event_name == 'workflow_dispatch' && 'main' || github.ref }} | |
| - name: Resolve version | |
| id: version | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="${{ inputs.version }}" | |
| else | |
| VERSION="${GITHUB_REF_NAME}" | |
| fi | |
| if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([-.].+)?$ ]]; then | |
| echo "Version must look like v0.2.0, got: $VERSION" | |
| exit 1 | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "plain=${VERSION#v}" >> "$GITHUB_OUTPUT" | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Log in to Aliyun Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.ACR_REGISTRY }} | |
| username: ${{ secrets.ALIYUN_REGISTRY_USER }} | |
| password: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }} | |
| - uses: docker/metadata-action@v5 | |
| id: meta | |
| with: | |
| images: | | |
| ${{ env.DOCKERHUB_IMAGE }} | |
| ${{ env.ACR_IMAGE }} | |
| tags: | | |
| type=raw,value=${{ steps.version.outputs.version }} | |
| type=raw,value=${{ steps.version.outputs.plain }} | |
| type=raw,value=latest | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| build-args: | | |
| COMPUTER_VERSION=${{ steps.version.outputs.version }} |