CD #179
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: CD | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * 1' | |
permissions: | |
contents: read | |
jobs: | |
release-please: | |
name: Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
tag_name: ${{ steps.get-tag-name.outputs.tag_name || steps.release.outputs.tag_name }} | |
steps: | |
- uses: googleapis/release-please-action@v4 | |
id: release | |
with: | |
target-branch: ${{ github.ref_name }} | |
# `release-please` doesn't provide the tag_name output when the release is not created. | |
# The tag is needed for the docker image version on scheduled builds. | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'schedule'}} | |
with: | |
fetch-depth: 0 | |
- name: Get the latest tag name | |
if: ${{ github.event_name == 'schedule'}} | |
id: get-tag-name | |
run: echo "tag_name=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | |
orchestrator: | |
name: Orchestrator | |
runs-on: ubuntu-latest | |
needs: | |
- release-please | |
outputs: | |
changed-directories: ${{ steps.changed-directories.outputs.all_changed_and_modified_files_count > 0 && steps.changed-directories.outputs.all_changed_files || null }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: tj-actions/changed-files@v44 | |
id: changed-directories | |
with: | |
files_ignore: | | |
.github/** | |
* | |
dir_names: true | |
docker: | |
name: Docker | |
if: ${{ needs.release-please.outputs.release_created || needs.orchestrator.outputs.changed-directories || github.event_name == 'schedule' }} | |
concurrency: | |
group: docker-${{ matrix.base }} | |
needs: | |
- release-please | |
- orchestrator | |
strategy: | |
fail-fast: false | |
matrix: | |
base: | |
- php/8.2/fpm-nginx | |
- php/8.2/fpm-apache | |
- php/8.3/fpm-nginx | |
- php/8.2/cli | |
- php/8.3/cli | |
- logstash/8.16.0/batch | |
exclude: | |
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-nginx') && 'ignored' || 'php/8.2/fpm-nginx' }} | |
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-apache') && 'ignored' || 'php/8.2/fpm-apache' }} | |
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.3/fpm-nginx') && 'ignored' || 'php/8.3/fpm-nginx' }} | |
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/cli') && 'ignored' || 'php/8.2/cli' }} | |
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.3/cli') && 'ignored' || 'php/8.3/cli' }} | |
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'logstash/8.16.0/batch') && 'ignored' || 'logstash/8.16.0/batch' }} | |
uses: ./.github/workflows/docker.yaml | |
with: | |
image-version: ${{ (needs.release-please.outputs.release_created || github.event_name == 'schedule') && needs.release-please.outputs.tag_name || github.sha }} | |
dockerfile-directory: ${{ matrix.base }} | |
repository: ${{ matrix.base }} | |
push: true | |
is-release: ${{ needs.release-please.outputs.release_created == 'true' }} | |
is-schedule-release: ${{ github.event_name == 'schedule' }} | |
permissions: | |
contents: read | |
id-token: write | |
packages: write | |
actions: read | |
security-events: write |