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: ""
|
default: ""
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lanes:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
strategy:
|
||||||
matrix: ${{ steps.set-matrix.outputs.result }}
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
lane: ["7.4"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get changed files
|
- name: Check for file changes
|
||||||
id: changed-files
|
id: changes
|
||||||
uses: tj-actions/changed-files@v44
|
uses: tj-actions/changed-files@v44
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
php-fpm/**
|
|
||||||
shared/php-fpm/**
|
|
||||||
.github/workflows/php-fpm.yml
|
.github/workflows/php-fpm.yml
|
||||||
|
shared/php-fpm/**
|
||||||
|
php-fpm/${{ matrix.lane }}/**
|
||||||
|
|
||||||
- name: Get all PHP lanes
|
- name: Set build flag
|
||||||
id: get-lanes
|
id: build-flag
|
||||||
run: |
|
run: |
|
||||||
echo "lanes=$(find php-fpm -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | jq -c -R . | jq -c -s .)" >> $GITHUB_OUTPUT
|
if [[ "${{ steps.changes.outputs.any_changed }}" == 'true' || "${{ github.event.inputs.lane }}" == 'all' || "${{ github.event.inputs.lane }}" == "${{ matrix.lane }}" ]]; then
|
||||||
shell: bash
|
echo "should_build=true"
|
||||||
|
|
||||||
- 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"
|
|
||||||
else
|
else
|
||||||
echo "build_all=false"
|
echo "should_build=false"
|
||||||
fi >> $GITHUB_OUTPUT
|
fi >> $GITHUB_OUTPUT
|
||||||
shell: bash
|
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
|
- name: Set up Docker Buildx
|
||||||
|
if: steps.build-flag.outputs.should_build == 'true'
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to the Container Registry
|
- name: Log in to the Container Registry
|
||||||
|
if: steps.build-flag.outputs.should_build == 'true'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: gitea.auvem.com
|
registry: gitea.auvem.com
|
||||||
@@ -115,19 +67,25 @@ jobs:
|
|||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
|
if: steps.build-flag.outputs.should_build == 'true'
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: gitea.auvem.com/auvem/wordpress-docker/php-fpm
|
images: gitea.auvem.com/auvem/wordpress-docker/php-fpm
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=${{ env.LANE }}-stable
|
type=raw,value=${{ matrix.lane }}-stable
|
||||||
type=raw,value=${{ env.LANE }}-${{ github.sha }}
|
type=raw,value=${{ matrix.lane }}-${{ github.sha }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
|
if: steps.build-flag.outputs.should_build == 'true'
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./php-fpm/${{ env.LANE }}/Dockerfile
|
file: ./php-fpm/${{ matrix.lane }}/Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
platforms: linux/amd64
|
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