Avoid if
syntax error (in VSCode) in generated CI config
#1274
This file contains 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 | |
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 |