Merge pull request #224 from stellarwp/2.1.2 #208
Workflow file for this run
This file contains hidden or 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: Publish slic-wordpress-php Docker image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - '[0-9]+.[0-9]+.[0-9]+' | |
| release: | |
| types: [published] | |
| jobs: | |
| publish-wordpress-image: | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| include: | |
| # WordPress 6.2 with PHP 8.0, 8.1, 8.2 - both architectures | |
| - wp_version: '6.2' | |
| php_version: '8.0' | |
| runner: ubuntu-latest | |
| platform: linux/amd64 | |
| arch: amd64 | |
| - wp_version: '6.2' | |
| php_version: '8.0' | |
| runner: ubuntu-24.04-arm | |
| platform: linux/arm64 | |
| arch: arm64 | |
| - wp_version: '6.2' | |
| php_version: '8.1' | |
| runner: ubuntu-latest | |
| platform: linux/amd64 | |
| arch: amd64 | |
| - wp_version: '6.2' | |
| php_version: '8.1' | |
| runner: ubuntu-24.04-arm | |
| platform: linux/arm64 | |
| arch: arm64 | |
| - wp_version: '6.2' | |
| php_version: '8.2' | |
| runner: ubuntu-latest | |
| platform: linux/amd64 | |
| arch: amd64 | |
| - wp_version: '6.2' | |
| php_version: '8.2' | |
| runner: ubuntu-24.04-arm | |
| platform: linux/arm64 | |
| arch: arm64 | |
| # WordPress 5.9 with PHP 7.3 - both architectures | |
| - wp_version: '5.9' | |
| php_version: '7.3' | |
| runner: ubuntu-latest | |
| platform: linux/amd64 | |
| arch: amd64 | |
| - wp_version: '5.9' | |
| php_version: '7.3' | |
| runner: ubuntu-24.04-arm | |
| platform: linux/arm64 | |
| arch: arm64 | |
| # WordPress 6.1.1 with PHP 7.4 - both architectures | |
| - wp_version: '6.1.1' | |
| php_version: '7.4' | |
| runner: ubuntu-latest | |
| platform: linux/amd64 | |
| arch: amd64 | |
| - wp_version: '6.1.1' | |
| php_version: '7.4' | |
| runner: ubuntu-24.04-arm | |
| platform: linux/arm64 | |
| arch: arm64 | |
| # WordPress 6.5 with PHP 8.3 - both architectures | |
| - wp_version: '6.5' | |
| php_version: '8.3' | |
| runner: ubuntu-latest | |
| platform: linux/amd64 | |
| arch: amd64 | |
| - wp_version: '6.5' | |
| php_version: '8.3' | |
| runner: ubuntu-24.04-arm | |
| platform: linux/arm64 | |
| arch: arm64 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_TOKEN }} | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }}-wordpress-php${{ matrix.php_version }} | |
| tags: | | |
| type=edge,branch=main | |
| type=ref,event=branch | |
| type=ref,event=tag | |
| type=semver,pattern={{raw}} | |
| flavor: | | |
| suffix=-${{ matrix.arch }},onlatest=true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: containers/wordpress | |
| file: containers/wordpress/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # Use the faster registry cache with platform-specific caching | |
| cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/cache/slic-wp-${{ matrix.wp_version }}-${{ matrix.php_version }}-${{ matrix.arch }} | |
| cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/cache/slic-wp-${{ matrix.wp_version }}-${{ matrix.php_version }}-${{ matrix.arch }},mode=max | |
| build-args: | | |
| PHP_VERSION=${{ matrix.php_version }} | |
| WP_VERSION=${{ matrix.wp_version }} | |
| platforms: ${{ matrix.platform }} | |
| create-wordpress-manifest: | |
| needs: publish-wordpress-image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| # Match the unique combinations from the build matrix | |
| include: | |
| - php_version: '8.0' | |
| - php_version: '8.1' | |
| - php_version: '8.2' | |
| - php_version: '7.3' | |
| - php_version: '7.4' | |
| - php_version: '8.3' | |
| steps: | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create and push multi-arch manifest | |
| run: | | |
| # Determine the tag based on the event type | |
| if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| TAG="edge" | |
| elif [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| else | |
| TAG="${GITHUB_REF#refs/heads/}" | |
| fi | |
| IMAGE_BASE="ghcr.io/${{ github.repository }}-wordpress-php${{ matrix.php_version }}" | |
| # Create multi-arch manifest | |
| docker buildx imagetools create -t "${IMAGE_BASE}:${TAG}" \ | |
| "${IMAGE_BASE}:${TAG}-amd64" \ | |
| "${IMAGE_BASE}:${TAG}-arm64" |