-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (39 loc) · 1.49 KB
/
Copy pathpull-push.yml
File metadata and controls
43 lines (39 loc) · 1.49 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
name: 将镜像上传到个人私有镜像仓库
on:
workflow_dispatch:
inputs:
oldimage_name:
description: '旧镜像名称'
imges_url:
description: '镜像仓库'
default: 'registry.cn-beijing.aliyuncs.com/duxiao'
server_name:
description: '服务名称'
type: choice
options:
- default
- k8s
- netshoot
- java
tag_name:
description: '镜像tag'
cpu_type:
default: 'amd64'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: pull
run: |
if [ "${{ github.event.inputs.cpu_type }}" = "amd64" ]; then
cpu_type="linux/amd64"
elif [ "${{ github.event.inputs.cpu_type }}" = "arm64" ]; then
cpu_type="linux/arm64/v8"
fi
echo "cpu_type=${cpu_type}"
docker login -u ${{ secrets.ALI_USER}} -p ${{ secrets.ALI_PASSWORD}} registry.cn-beijing.aliyuncs.com
docker pull --platform ${cpu_type} ${{ github.event.inputs.oldimage_name }}
docker tag ${{ github.event.inputs.oldimage_name }} ${{ github.event.inputs.imges_url }}/${{ github.event.inputs.server_name }}:${{ github.event.inputs.tag_name }}
echo ${{ github.event.inputs.imges_url }}/${{ github.event.inputs.server_name }}:${{ github.event.inputs.tag_name }}
docker push ${{ github.event.inputs.imges_url }}/${{ github.event.inputs.server_name }}:${{ github.event.inputs.tag_name }}