Repository navigation
docs: recommend declaring the Rust MSRV (#3317) #1942
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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_2 | |
| 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 |