forked from Ji-Yuhang/docker-pull-proxy
-
Notifications
You must be signed in to change notification settings - Fork 281
55 lines (46 loc) · 1.44 KB
/
docker-sync.yaml
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
name: Docker-sync
# 这个是测试脚本
on:
push:
branches: [ main ]
# pull_request:
# branches: [ main ]
env:
REGISTRY: registry.cn-hangzhou.aliyuncs.com
ALIYUN_REGISTRY_USER: "${{ secrets.ALIYUN_REGISTRY_USER }}"
ALIYUN_REGISTRY_PASSWORD: "${{ secrets.ALIYUN_REGISTRY_PASSWORD }}"
MM_NOTIFY_URL: "${{ secrets.MM_NOTIFY_URL }}"
jobs:
build:
name: sync
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: pare trigger
run: |
data=`cat trigger.txt`
src=$(echo $data | awk '{print $1}')
dist=$(echo $data | awk '{print $2}')
echo "src=${src}" >> "$GITHUB_ENV"
echo "dist=${dist}" >> "$GITHUB_ENV"
# - name: Copy beta to ECR
# uses: truemark/skopeo-copy-action@v1
# with:
# src-image: "docker://$src"
# dest-image: "docker://$dist"
# dest-username: "${{ secrets.ALIYUN_REGISTRY_USER }}"
# dest-password: "${{ secrets.ALIYUN_REGISTRY_PASSWORD }}"
# multi-arch: "all"
- name: 'notify'
run: |
echo "src=${src}"
echo "dist=${dist}"
data=`cat trigger.txt`
if [ $MM_NOTIFY_URL ];then
curl -H 'Content-Type: application/json' \
-d "{\"msgtype\": \"text\",\"text\": {\"content\":\"同步成功 $data \"}}" \
$MM_NOTIFY_URL
else
echo 'MM_NOTIFY_URL not set'
fi