chore: update qemu action #22
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: Create and publish a Docker image | |
# Cache setup: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md | |
# Multi push: https://github.com/docker/build-push-action/blob/master/docs/advanced/push-multi-registries.md | |
on: | |
push: | |
branches: ["*"] | |
pull_request: | |
jobs: | |
checks-update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check update has been run | |
run: | | |
./update.sh | |
git diff --quiet | |
checks-hadolint: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
container: hadolint/hadolint:latest-debian | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check hadolint | |
run: | | |
hadolint */Dockerfile | |
checks-shfmt: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
container: mvdan/shfmt:latest-alpine | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check shfmt | |
run: | | |
shfmt -i 2 -ci -d update.sh | |
checks-shellcheck: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
container: koalaman/shellcheck-alpine:latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check shellcheck | |
run: | | |
shellcheck update.sh | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
version: ["3.57", "3"] | |
needs: [checks-hadolint, checks-shfmt, checks-shellcheck, checks-update] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
if: github.ref == 'refs/heads/main' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ekreative/php-cs-fixer | |
tags: | | |
type=raw,value=${{ matrix.version }} | |
flavor: | | |
latest=${{ toJSON(matrix.version == '3' && github.ref == 'refs/heads/main') }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.version }} | |
# Build for Linux and Apple Silicon processors | |
platforms: linux/amd64,linux/arm64,linux/arm64/v8 | |
push: ${{ github.ref == 'refs/heads/main' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |