buildx #840
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: buildx | |
on: | |
schedule: | |
- cron: '0 10 * * *' # everyday at 10am | |
push: | |
branches: main | |
pull_request: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
buildx: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: true | |
matrix: | |
php-version: | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
- "8.4" | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Store the PHP base image name | |
id: image | |
env: | |
PHP_VERSION: ${{ matrix.php-version }} | |
run: | | |
USE_VERSION=$PHP_VERSION | |
echo "name=$USE_VERSION" >> "$GITHUB_OUTPUT" | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
continue-on-error: true | |
id: buildx1 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php-version }}-multi | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
PHP_VERSION=${{ steps.image.outputs.name }} | |
- name: Wait to retry | |
if: steps.buildx1.outcome != 'success' | |
run: | | |
sleep 60 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
if: steps.buildx1.outcome != 'success' | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php-version }}-multi | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
PHP_VERSION=${{ steps.image.outputs.name }} | |
- | |
name: Clear | |
if: always() && github.event_name != 'pull_request' | |
run: | | |
rm -f ${HOME}/.docker/config.json | |
notify: | |
runs-on: ubuntu-latest | |
needs: buildx | |
steps: | |
- name: Trigger Workflow | |
uses: actions/github-script@v6 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
github-token: ${{ secrets.PAT }} | |
script: | | |
github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: 'update-check-runner', | |
workflow_id: 'buildx.yml', | |
ref: 'main', | |
}) |