-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (71 loc) · 2.2 KB
/
build.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
72
73
74
75
76
77
78
79
80
81
82
name: Docker Build
on:
push:
branches:
- main
tags:
- "*"
pull_request:
jobs:
build:
runs-on: ubuntu-latest
env:
release: "0.8.1"
defaultpython: "3.12"
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
image:
- tag: "ghcr.io/tgsai/mdio"
context: "./base"
- tag: "ghcr.io/tgsai/mdio-dask"
context: "./dask"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
if: github.repository == 'tgsai/mdio-docker' && github.event_name == 'push'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate tags
id: tags
env:
image: ${{ matrix.image.tag }}
python: ${{ matrix.python }}
stable: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
if [ "$stable" == "true" ]; then
tag="${image}:${release}-py${python}"
tags=${image}:latest-py${python},$tag
if [ "$python" == "$defaultpython" ]; then
tags=${image}:latest,${image}:${release},$tags
fi
else
tag="${image}:dev-py${python}"
tags=$tag
if [ "$python" == "$defaultpython" ]; then
tags=${image}:dev,$tags
fi
fi
echo "::set-output name=tags::${tags}"
echo "::set-output name=tag::${tag}"
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ matrix.image.context }}
push: ${{ github.repository == 'tgsai/mdio-docker' && github.event_name == 'push' }}
platforms: linux/amd64
tags: ${{ steps.tags.outputs.tags }}
build-args: |
python=${{ matrix.python }}
release=${{ env.release }}
- name: Report
run: echo Built ${{ steps.tags.outputs.tags }}