Update release_pipeline.yml

This commit is contained in:
Jonathan Miller
2026-01-01 09:00:18 -06:00
committed by GitHub
parent aa80746b50
commit 00bf93df11

View File

@@ -1,68 +1,72 @@
# ============================================================================ ============================================================================
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
# Copyright (C) 2025 Moko Consulting hello@mokoconsulting.tech
# This file is part of a Moko Consulting project.
#
# SPDX-License-Identifier: GPL-3.0-or-later
# This file is part of a Moko Consulting project.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the This program is free software; you can redistribute it and/or modify
# GNU General Public License for more details.
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. the Free Software Foundation; either version 3 of the License, or
#
# FILE INFORMATION (at your option) any later version.
# DEFGROUP: GitHub.Workflow
# INGROUP: MokoStandards.Release
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
# PATH: /.github/workflows/release_pipeline.yml This program is distributed in the hope that it will be useful,
# VERSION: 03.05.00
# BRIEF: Enterprise release pipeline enforcing dev to rc to version to main. Creates prerelease when rc is created. Creates full release when version is created and promotes to main while retaining the version branch. but WITHOUT ANY WARRANTY; without even the implied warranty of
# NOTE:
# ============================================================================ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/.
FILE INFORMATION
DEFGROUP: GitHub.Workflow
INGROUP: MokoStandards.Release
REPO: https://github.com/mokoconsulting-tech/MokoStandards
PATH: /.github/workflows/release_pipeline.yml
VERSION: 03.05.00
BRIEF: Enterprise release pipeline enforcing dev to rc to version to main. Creates prerelease when rc is created. Creates full release when version is created and promotes to main while retaining the version branch.
NOTE:
============================================================================
name: Release Pipeline (dev > rc > version > main) name: Release Pipeline (dev > rc > version > main)
on: on: workflow_dispatch: inputs: release_classification: description: "Manual override for classification. auto follows branch policy; rc forces prerelease behavior; stable forces full release behavior." required: true default: auto type: choice options: - auto - rc - stable release: types: - created - prereleased - published
workflow_dispatch:
inputs:
release_classification:
description: "Manual override for classification. auto follows branch policy; rc forces prerelease behavior; stable forces full release behavior."
required: true
default: auto
type: choice
options:
- auto
- rc
- stable
release:
types:
- created
- prereleased
- published
concurrency: concurrency: group: release-pipeline-${{ github.ref_name }} cancel-in-progress: false
group: release-pipeline-${{ github.ref_name }}
cancel-in-progress: false
defaults: defaults: run: shell: bash
run:
shell: bash
permissions: permissions: contents: read
contents: read
jobs: jobs: guard: name: 00 Guardrails and metadata runs-on: ubuntu-latest
guard:
name: 00 Guardrails and metadata
runs-on: ubuntu-latest
outputs: outputs:
version: ${{ steps.meta.outputs.version }} version: ${{ steps.meta.outputs.version }}
@@ -249,9 +253,8 @@ jobs:
printf '"runner_os":"%s",' "${RUNNER_OS}" printf '"runner_os":"%s",' "${RUNNER_OS}"
printf '"runner_name":"%s"' "${RUNNER_NAME}" printf '"runner_name":"%s"' "${RUNNER_NAME}"
printf '} printf '}
'
echo "```" ' echo "```" } >> "${GITHUB_STEP_SUMMARY}"
} >> "${GITHUB_STEP_SUMMARY}"
{ {
echo "### Git snapshot" echo "### Git snapshot"
@@ -262,10 +265,7 @@ jobs:
echo "```" echo "```"
} >> "${GITHUB_STEP_SUMMARY}" } >> "${GITHUB_STEP_SUMMARY}"
promote_branch: promote_branch: name: 01 Promote branch and delete source runs-on: ubuntu-latest needs: guard
name: 01 Promote branch and delete source
runs-on: ubuntu-latest
needs: guard
if: ${{ github.event_name == 'workflow_dispatch' }} if: ${{ github.event_name == 'workflow_dispatch' }}
@@ -348,16 +348,10 @@ jobs:
printf '"ref_name":"%s",' "${GITHUB_REF_NAME}" printf '"ref_name":"%s",' "${GITHUB_REF_NAME}"
printf '"sha":"%s"' "${GITHUB_SHA}" printf '"sha":"%s"' "${GITHUB_SHA}"
printf '} printf '}
'
echo "```"
} >> "${GITHUB_STEP_SUMMARY}"
normalize_dates: ' echo "```" } >> "${GITHUB_STEP_SUMMARY}"
name: 02 Normalize dates on promoted branch
runs-on: ubuntu-latest normalize_dates: name: 02 Normalize dates on promoted branch runs-on: ubuntu-latest needs: - guard - promote_branch
needs:
- guard
- promote_branch
if: ${{ github.event_name == 'workflow_dispatch' }} if: ${{ github.event_name == 'workflow_dispatch' }}
@@ -420,18 +414,13 @@ jobs:
done done
if [ -z "${SCRIPT}" ]; then if [ -z "${SCRIPT}" ]; then
FOUND="$(find . -maxdepth 3 -type f \( -name 'update_dates.sh' -o -name 'update-dates.sh' \) 2>/dev/null | head -n 5 || true)" FOUND="$(find . -maxdepth 3 -type f -name 'update_dates.sh' -o -name 'update-dates.sh' 2>/dev/null | head -n 5 || true)"
{ {
echo "ERROR: Date normalization script not found in approved locations." echo "ERROR: Date normalization script not found in approved locations."
echo "Approved locations:" echo "Approved locations:"
printf '%s printf '%s
' "${CANDIDATES[@]}"
echo "Discovered candidates (first 5):" ' "${CANDIDATES[@]}" echo "Discovered candidates (first 5):" echo "${FOUND:-<none>}" echo "Required action: add scripts/release/update_dates.sh (preferred) to the repo." } >> "${GITHUB_STEP_SUMMARY}" exit 1 fi
echo "${FOUND:-<none>}"
echo "Required action: add scripts/release/update_dates.sh (preferred) to the repo."
} >> "${GITHUB_STEP_SUMMARY}"
exit 1
fi
echo "Using date script: ${SCRIPT}" >> "${GITHUB_STEP_SUMMARY}" echo "Using date script: ${SCRIPT}" >> "${GITHUB_STEP_SUMMARY}"
@@ -468,12 +457,7 @@ jobs:
echo "```" echo "```"
} >> "${GITHUB_STEP_SUMMARY}" } >> "${GITHUB_STEP_SUMMARY}"
build_and_release: build_and_release: name: 03 Build ZIP, upload to SFTP, create GitHub release runs-on: ubuntu-latest needs: - guard - normalize_dates
name: 03 Build ZIP, upload to SFTP, create GitHub release
runs-on: ubuntu-latest
needs:
- guard
- normalize_dates
if: ${{ github.event_name == 'workflow_dispatch' }} if: ${{ github.event_name == 'workflow_dispatch' }}
@@ -551,12 +535,11 @@ jobs:
sep=","; sep=",";
done done
printf '],"channel":"%s","deploy_dry_run":"%s","credential_presence":{"FTP_KEY":"%s","FTP_PASSWORD":"%s"}} printf '],"channel":"%s","deploy_dry_run":"%s","credential_presence":{"FTP_KEY":"%s","FTP_PASSWORD":"%s"}}
' \
"${CHANNEL}" "${DEPLOY_DRY_RUN:-false}" \ '
"$( [ "${key_present}" = "true" ] && echo present || echo missing )" \ "${CHANNEL}" "${DEPLOY_DRY_RUN:-false}"
"$( [ "${pw_present}" = "true" ] && echo present || echo missing )" "$( [ "${key_present}" = "true" ] && echo present || echo missing )"
echo "```" "$( [ "${pw_present}" = "true" ] && echo present || echo missing )" echo "```" } >> "${GITHUB_STEP_SUMMARY}"
} >> "${GITHUB_STEP_SUMMARY}"
if [ "${#missing[@]}" -gt 0 ]; then if [ "${#missing[@]}" -gt 0 ]; then
exit 1 exit 1
@@ -600,11 +583,8 @@ jobs:
sep=","; sep=",";
done done
printf ']} printf ']}
'
echo "```" ' echo "```" } >> "${GITHUB_STEP_SUMMARY}" exit 1 fi
} >> "${GITHUB_STEP_SUMMARY}"
exit 1
fi
ran=() ran=()
skipped=() skipped=()
@@ -657,9 +637,8 @@ jobs:
done done
printf ']} printf ']}
'
echo "```" ' echo "```" } >> "${GITHUB_STEP_SUMMARY}"
} >> "${GITHUB_STEP_SUMMARY}"
- name: Build Joomla ZIP (extension type aware, src-only archive) - name: Build Joomla ZIP (extension type aware, src-only archive)
id: build id: build
@@ -830,9 +809,8 @@ jobs:
printf '"FTP_PASSWORD":"%s"' "$( [ "${PASSWORD_PRESENT}" = "true" ] && echo present || echo missing )" printf '"FTP_PASSWORD":"%s"' "$( [ "${PASSWORD_PRESENT}" = "true" ] && echo present || echo missing )"
printf '}' printf '}'
printf '} printf '}
'
echo "```" ' echo "```" } >> "${GITHUB_STEP_SUMMARY}"
} >> "${GITHUB_STEP_SUMMARY}"
if [ "${KEY_PRESENT}" = "true" ] && [ "${PASSWORD_PRESENT}" = "true" ]; then if [ "${KEY_PRESENT}" = "true" ] && [ "${PASSWORD_PRESENT}" = "true" ]; then
echo "Password provided but ignored because key auth is in use." >> "${GITHUB_STEP_SUMMARY}" echo "Password provided but ignored because key auth is in use." >> "${GITHUB_STEP_SUMMARY}"
@@ -1035,7 +1013,7 @@ jobs:
VERSION="${{ needs.guard.outputs.version }}" VERSION="${{ needs.guard.outputs.version }}"
ZIP_ASSET="${{ steps.build.outputs.zip_name }}" ZIP_ASSET="${{ steps.build.outputs.zip_name }}"
awk "/^## \[${VERSION}\]/{flag=1;next}/^## \[/ {flag=0}flag" CHANGELOG.md > RELEASE_NOTES.md || true awk "/^## ${VERSION}/{flag=1;next}/^## \[/ {flag=0}flag" CHANGELOG.md > RELEASE_NOTES.md || true
if [ ! -s RELEASE_NOTES.md ]; then if [ ! -s RELEASE_NOTES.md ]; then
echo "ERROR: Release notes extraction failed for ${VERSION}" >> "${GITHUB_STEP_SUMMARY}" echo "ERROR: Release notes extraction failed for ${VERSION}" >> "${GITHUB_STEP_SUMMARY}"
@@ -1082,12 +1060,7 @@ jobs:
echo "```" echo "```"
} >> "${GITHUB_STEP_SUMMARY}" } >> "${GITHUB_STEP_SUMMARY}"
push_version_to_main: push_version_to_main: name: 04 Promote version branch to main (stable only, keep version branch) runs-on: ubuntu-latest needs: - guard - build_and_release
name: 04 Promote version branch to main (stable only, keep version branch)
runs-on: ubuntu-latest
needs:
- guard
- build_and_release
if: ${{ github.event_name == 'workflow_dispatch' && needs.guard.outputs.release_mode == 'stable' }} if: ${{ github.event_name == 'workflow_dispatch' && needs.guard.outputs.release_mode == 'stable' }}
@@ -1153,10 +1126,7 @@ jobs:
echo "```" echo "```"
} >> "${GITHUB_STEP_SUMMARY}" } >> "${GITHUB_STEP_SUMMARY}"
release_event_report: release_event_report: name: 99 Release event report (GitHub UI created release) runs-on: ubuntu-latest needs: guard
name: 99 Release event report (GitHub UI created release)
runs-on: ubuntu-latest
needs: guard
if: ${{ github.event_name == 'release' }} if: ${{ github.event_name == 'release' }}