php-fpm: drop dynamic matrix, unsupported by gitea
All checks were successful
php-fpm-build / build (7.4) (push) Successful in 5m4s
All checks were successful
php-fpm-build / build (7.4) (push) Successful in 5m4s
This commit is contained in:
94
.github/workflows/php-fpm.yml
vendored
94
.github/workflows/php-fpm.yml
vendored
@@ -21,92 +21,44 @@ on:
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
lanes:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.result }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
lane: ["7.4"]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
- name: Check for file changes
|
||||
id: changes
|
||||
uses: tj-actions/changed-files@v44
|
||||
with:
|
||||
files: |
|
||||
php-fpm/**
|
||||
shared/php-fpm/**
|
||||
.github/workflows/php-fpm.yml
|
||||
shared/php-fpm/**
|
||||
php-fpm/${{ matrix.lane }}/**
|
||||
|
||||
- name: Get all PHP lanes
|
||||
id: get-lanes
|
||||
- name: Set build flag
|
||||
id: build-flag
|
||||
run: |
|
||||
echo "lanes=$(find php-fpm -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | jq -c -R . | jq -c -s .)" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: Get changed PHP lanes
|
||||
id: changed-lanes
|
||||
run: |
|
||||
changed_lanes=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep '^php-fpm/' || true | cut -d'/' -f2 | sort -u | jq -c -R . | jq -c -s .)
|
||||
echo "lanes=${changed_lanes:-[]}" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: Check for changes requiring all lanes to be built
|
||||
id: build-all-check
|
||||
run: |
|
||||
if echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep -q -e '^\.github/workflows/' -e '^shared/php-fpm/'; then
|
||||
echo "build_all=true"
|
||||
if [[ "${{ steps.changes.outputs.any_changed }}" == 'true' || "${{ github.event.inputs.lane }}" == 'all' || "${{ github.event.inputs.lane }}" == "${{ matrix.lane }}" ]]; then
|
||||
echo "should_build=true"
|
||||
else
|
||||
echo "build_all=false"
|
||||
echo "should_build=false"
|
||||
fi >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: Generate matrix for build job
|
||||
id: set-matrix
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
result-encoding: json
|
||||
script: |
|
||||
const req_lane = "${{ github.event.inputs.lane }}";
|
||||
const build_all = ${{ steps.build-all-check.outputs.build_all == 'true' }};
|
||||
const all_lanes = JSON.parse('${{ steps.get-lanes.outputs.lanes }}' || '[]');
|
||||
const changed_lanes = JSON.parse('${{ steps.changed-lanes.outputs.lanes }}' || '[]');
|
||||
|
||||
let lanes_to_build = [];
|
||||
|
||||
if (req_lane) {
|
||||
if (req_lane === "all") {
|
||||
lanes_to_build = all_lanes;
|
||||
} else {
|
||||
lanes_to_build = [req_lane];
|
||||
}
|
||||
} else if (build_all) {
|
||||
lanes_to_build = all_lanes;
|
||||
} else {
|
||||
lanes_to_build = changed_lanes;
|
||||
}
|
||||
|
||||
return { lane: lanes_to_build };
|
||||
|
||||
build:
|
||||
needs: lanes
|
||||
if: ${{ fromJson(needs.lanes.outputs.matrix).lane[0] }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.lanes.outputs.matrix) }}
|
||||
env:
|
||||
LANE: ${{ matrix.lane }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
if: steps.build-flag.outputs.should_build == 'true'
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to the Container Registry
|
||||
if: steps.build-flag.outputs.should_build == 'true'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.auvem.com
|
||||
@@ -115,19 +67,25 @@ jobs:
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
if: steps.build-flag.outputs.should_build == 'true'
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: gitea.auvem.com/auvem/wordpress-docker/php-fpm
|
||||
tags: |
|
||||
type=raw,value=${{ env.LANE }}-stable
|
||||
type=raw,value=${{ env.LANE }}-${{ github.sha }}
|
||||
type=raw,value=${{ matrix.lane }}-stable
|
||||
type=raw,value=${{ matrix.lane }}-${{ github.sha }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
if: steps.build-flag.outputs.should_build == 'true'
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./php-fpm/${{ env.LANE }}/Dockerfile
|
||||
file: ./php-fpm/${{ matrix.lane }}/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64
|
||||
|
||||
- name: Report build status
|
||||
if: steps.build-flag.outputs.should_build == 'false'
|
||||
run: echo "Skipping build for ${{ matrix.lane }}. No relevant changes detected."
|
||||
|
||||
Reference in New Issue
Block a user