-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (78 loc) · 2.56 KB
/
Copy pathrelease-image.yml
File metadata and controls
90 lines (78 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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 }}