-
-
Notifications
You must be signed in to change notification settings - Fork 272
57 lines (55 loc) · 2 KB
/
docker.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
name: Docker Publish
on:
push:
branches:
- main
tags: [ 'v*' ]
jobs:
publish-docker:
name: Publish Docker Images
runs-on: ubuntu-latest
environment:
name: Docker Hub
url: https://ghcr.io/pyo3/maturin
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@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: dbhi/qus/action@main
- uses: docker/setup-buildx-action@v3
if: ${{ steps.changes.outputs.changed == 'true' || startsWith(github.ref, 'refs/tags/') }}
- uses: docker/metadata-action@v5
if: ${{ steps.changes.outputs.changed == 'true' || startsWith(github.ref, 'refs/tags/') }}
id: meta
with:
images: ghcr.io/pyo3/maturin
- name: Login to GitHub Container Registry
if: ${{ steps.changes.outputs.changed == 'true' || startsWith(github.ref, 'refs/tags/') }}
uses: docker/login-action@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@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#registry-cache
cache-from: type=registry,ref=ghcr.io/pyo3/maturin:buildcache
cache-to: type=registry,ref=ghcr.io/pyo3/maturin:buildcache,mode=max