-
-
Notifications
You must be signed in to change notification settings - Fork 423
73 lines (71 loc) · 2.98 KB
/
Copy pathdocker.yml
File metadata and controls
73 lines (71 loc) · 2.98 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
name: Docker Publish
on:
push:
branches:
- main
tags: ["v*"]
jobs:
publish-docker:
name: Publish Docker Images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compatibility:
- name: manylinux
tag-suffix: ''
manylinux: manylinux2014
- name: musllinux
tag-suffix: '-musllinux'
manylinux: musllinux_1_1
environment:
name: Docker Hub
url: https://ghcr.io/pyo3/maturin
steps:
- name: Get image name from repository
id: image
run: python -c 'print("image=ghcr.io/${{ github.repository }}".lower())' >> $GITHUB_OUTPUT
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: changes
with:
filters: |
changed:
- 'Cargo.toml'
- 'Cargo.lock'
- 'src/**'
- 'Dockerfile'
- '.github/workflows/docker.yml'
- '.dockerignore'
- name: Setup QEMU
if: ${{ steps.changes.outputs.changed == 'true' || startsWith(github.ref, 'refs/tags/') }}
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
if: ${{ steps.changes.outputs.changed == 'true' || startsWith(github.ref, 'refs/tags/') }}
- uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
if: ${{ steps.changes.outputs.changed == 'true' || startsWith(github.ref, 'refs/tags/') }}
id: meta
with:
images: ${{ steps.image.outputs.image }}
flavor: |
suffix=${{ matrix.compatibility.tag-suffix }},onlatest=true
- name: Login to GitHub Container Registry
if: ${{ steps.changes.outputs.changed == 'true' || startsWith(github.ref, 'refs/tags/') }}
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
if: ${{ steps.changes.outputs.changed == 'true' || startsWith(github.ref, 'refs/tags/') }}
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: MANYLINUX=${{ matrix.compatibility.manylinux }}
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#registry-cache
cache-from: type=registry,ref=${{ steps.image.outputs.image }}:buildcache${{ matrix.compatibility.tag-suffix }}
cache-to: type=registry,ref=${{ steps.image.outputs.image }}:buildcache${{ matrix.compatibility.tag-suffix }},mode=max