Skip to content

Update trigger.txt

Update trigger.txt #11

Workflow file for this run

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
outputs:
output1: ${{ steps.pare.outputs.src }}
output2: ${{ steps.pare.outputs.dist }}
steps:
- name: Check out code
uses: actions/checkout@v2
- name: pare trigger
id: pare
run: |
data=`cat trigger.txt`
src=$(echo $data | awk '{print $1}')
dist=$(echo $data | awk '{print $2}')
echo "src=${src}" >> "$GITHUB_OUTPUT"
echo "dist=${dist}" >> "$GITHUB_OUTPUT"
- name: Copy beta to ECR
uses: truemark/skopeo-copy-action@v1
with:
src-image: "docker://${{ steps.pare.outputs.src }}"
dest-image: "docker://${{ steps.pare.outputs.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