build-debug-image #121
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-debug-image | |
on: | |
push: | |
paths: | |
- '.github/workflows/publish-php-debug-images.yml' | |
schedule: | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
jobs: | |
push_to_registry: | |
if: github.repository_owner == 'open-telemetry' #do not run in forks | |
name: Build image | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: ['8.0', '8.1', '8.2', '8.3'] | |
os: ['debian', 'alpine'] | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: check out the repo | |
uses: actions/checkout@v4 | |
- 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.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Fetch latest PHP version | |
run: | | |
PHP_VERSION=$(curl https://www.php.net/releases/index.php?json\&version=${{ matrix.php-version }}\&max=1 | jq -r 'keys[0]') | |
echo "PHP_VERSION=${PHP_VERSION}" >> $GITHUB_ENV | |
echo "Latest version in ${{ matrix.php-version }} is ${PHP_VERSION}" | |
- name: Build and push ${{ env.PHP_VERSION }} as ${{ matrix.php-version }}-${{ matrix.os }} to ghcr.io | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
file: docker/Dockerfile.${{ matrix.os }} | |
build-args: | | |
PHP_VERSION=${{ env.PHP_VERSION }} | |
tags: ghcr.io/open-telemetry/opentelemetry-php-instrumentation/php:${{ matrix.php-version }}-${{ matrix.os }}-debug |