This repository has been archived by the owner on Aug 13, 2023. It is now read-only.
Build Docker image #424
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: Build Docker image | |
on: | |
schedule: | |
- cron: '0 */6 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
pm-version: [4, 5] | |
branch: [php/8.0, php/8.1, php/8.2] | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: pmmp/PHP-Binaries | |
ref: ${{ matrix.branch }} | |
path: build/ | |
- name: Get repository name | |
id: repo-name | |
run: echo "value=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get PHP version | |
id: php-version | |
run: echo "value=$(grep -oP '(?<=PHP_VERSION=\").+(?=\")' build/compile.sh | awk -F'.' '{print $1 "." $2}')" >> $GITHUB_OUTPUT | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
context: build/ | |
file: Dockerfile | |
tags: | | |
ghcr.io/${{ steps.repo-name.outputs.value }}:${{ matrix.pm-version }}-${{ steps.php-version.outputs.value }} | |
build-args: | | |
PM_VERSION=${{ matrix.pm-version }} |