-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (68 loc) · 1.95 KB
/
backup-to-acr.yml
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
name: Backup to ACR
on:
workflow_dispatch:
inputs:
from:
description: ""
default: "alpine/git"
required: false
new-tag:
description: ""
default: "alpine-git"
required: false
maximize-disk:
description: ""
default: "1"
required: false
# Environment variables available to all jobs and steps in this workflow.
env:
REGION_ID: cn-beijing
REGISTRY: registry.cn-beijing.aliyuncs.com
NAMESPACE: oneflow
TAG: ${{ github.sha }}
jobs:
back-up-to-acr:
name: "Backup image to ACR"
runs-on: ubuntu-latest
environment: production
strategy:
fail-fast: false
max-parallel: 5
matrix:
pytorch-version: [1.9.0]
env:
FROM: ${{ github.event.inputs.from }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
if: inputs.maximize-disk == '1'
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
overprovision-lvm: "true"
- name: Checkout
uses: actions/checkout@v2
- name: Set env
run: |
NEW_TAG="$REGISTRY/$NAMESPACE/${{ github.event.inputs.new-tag }}"
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
# 1.1 Login to ACR
- name: Login to ACR with the AccessKey pair
uses: aliyun/acr-login@v1
with:
login-server: https://registry.${{env.REGION_ID}}.aliyuncs.com
username: "${{ secrets.ACR_USERNAME }}"
password: "${{ secrets.ACR_PASSWORD }}"
# 1.2 Buid and push image to ACR
- name: Pull and tag image
run: |
docker pull "${{env.FROM}}"
docker tag "${{env.FROM}}" ${{env.NEW_TAG}}
- name: Push image to ACR
run: |
docker push ${{env.NEW_TAG}}