Skip to content

ci: Configure the TERM environment variable for the autoreview workflow #518

ci: Configure the TERM environment variable for the autoreview workflow

ci: Configure the TERM environment variable for the autoreview workflow #518

Workflow file for this run

name: Docker
on:
push:
branches: [ main ]
pull_request: ~
schedule:
# Do not make it the first of the month and/or midnight since it is a very busy time
- cron: "* 10 5 * *"
release:
types: [ created ]
# See https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
docker-build:
runs-on: ubuntu-20.04
name: Publish the Docker image ${{ matrix.name }}
# See https://github.com/phpstan/phpstan/commit/4a535193101975e50fbaeea92ca6eca8c7a349b1
concurrency: docker-build-${{ github.ref }}-${{ matrix.docker-file }}
strategy:
fail-fast: false
matrix:
include:
- name: PHP 7.2.5
docker-file: .docker/php725
image-tag: ghcr.io/box-project/box_php725
- name: PHP 8.1
docker-file: .docker/php81
image-tag: ghcr.io/box-project/box_php81
- name: PHP 8.1 (Xdebug)
docker-file: .docker/php81_xdebug
image-tag: ghcr.io/box-project/box_php81_xdebug
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and export to Docker
uses: docker/build-push-action@v3
with:
context: .
file: ${{ matrix.docker-file }}
platforms: linux/amd64
tags: ${{ matrix.image-tag }}
load: true
- name: Test the image
run: docker run --rm ${{ matrix.image-tag }} php --version
- name: Build and push
if: ${{ github.ref_name == 'main' }}
uses: docker/build-push-action@v3
with:
context: .
file: ${{ matrix.docker-file }}
platforms: linux/amd64
tags: ${{ matrix.image-tag }}
push: true
# See https://github.com/phpstan/phpstan/pull/7373/files
# for the scope.
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
# This is a "trick", a meta task which does not change, and we can use in
# the protected branch rules as opposed to the tests one above which
# may change regularly.
validate-images:
name: Docker status
runs-on: ubuntu-latest
needs: docker-build
if: always()
steps:
- run: exit 0