-
Notifications
You must be signed in to change notification settings - Fork 212
96 lines (86 loc) · 3.1 KB
/
image_dlrover_master.yml
File metadata and controls
96 lines (86 loc) · 3.1 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
91
92
93
94
95
96
---
name: build and publish dlrover release master image
on:
workflow_dispatch:
release:
types:
- published
env:
REGISTRY: ghcr.io
SET_API: https://api.github.com/orgs/intelligent-machine-learning/packages/container # yamllint disable-line
VER_REG: s/.*version=['\"]([^'\"]+)['\"].*/\1/
jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
matrix:
build_info:
- py_version: "3.8.14"
py_tag: "py38"
platform: "linux/amd64"
dockerfile: "./docker/release/master.dockerfile"
image_name: "release_dlrover_master_py38"
- py_version: "3.8.14"
py_tag: "py38"
platform: "linux/arm64"
dockerfile: "./docker/release/master.dockerfile.aarch64"
image_name: "release_dlrover_master_py38_aarch64"
- py_version: "3.10.17"
py_tag: "py310"
platform: "linux/amd64"
dockerfile: "./docker/release/master.dockerfile"
image_name: "release_dlrover_master_py310"
- py_version: "3.10.17"
py_tag: "py310"
platform: "linux/arm64"
dockerfile: "./docker/release/master.dockerfile.aarch64"
image_name: "release_dlrover_master_py310_aarch64"
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout Branch
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract version from SETUP
run: |
VERSION=$(grep "version=" setup.py | sed -E "${{ env.VER_REG }}")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.build_info.image_name }} # yamllint disable-line
- name: Build and Push Image
uses: docker/build-push-action@v4
with:
context: ./
file: ${{ matrix.build_info.dockerfile }}
platforms: ${{ matrix.build_info.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ env.VERSION }}
PY_VERSION=${{ matrix.build_info.py_version }}
PY_TAG=${{ matrix.build_info.py_tag }}
platform=${{ matrix.build_info.platform }}
- name: Set Image Public
run: |
curl -X PATCH \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
${{ env.SET_API }}/${{ matrix.build_info.image_name }}/visibility \
-d '{"visibility":"public"}'