forked from jzaki/zaki-bazaar
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (61 loc) · 2.35 KB
/
Copy pathrelease-all.yml
File metadata and controls
66 lines (61 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Release all modules
# Umbrella workflow: releases every submodule in this catalog in
# parallel. Useful for the initial bootstrap and for coordinated
# "everything at once" releases.
#
# The module list is DISCOVERED from `.gitmodules` at run time — add or
# remove a submodule and this workflow tracks it automatically, no edits
# here ever needed (the previous hand-maintained matrix is gone).
#
# Each module is released through the same _release-module.yml local
# reusable workflow the per-module files use, so signing config stays
# consistent between solo and bulk runs. `fail-fast: false` lets one
# module's build fail without aborting the rest.
on:
workflow_dispatch:
inputs:
force_build:
description: "Force build — replace the current published release if it has the same version."
type: boolean
default: false
# Forked repos default to a read-only GITHUB_TOKEN.
permissions:
contents: write
jobs:
discover:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.scan.outputs.matrix }}
count: ${{ steps.scan.outputs.count }}
steps:
- uses: actions/checkout@v4
- id: scan
shell: bash
run: |
set -euo pipefail
# Every `path = submodules/<repo>` entry in .gitmodules.
paths="$(git config --file .gitmodules --get-regexp 'submodule\..*\.path$' 2>/dev/null \
| awk '{print $2}' | sort -u || true)"
if [ -z "${paths}" ]; then
echo 'matrix={"module_path":[]}' >> "$GITHUB_OUTPUT"
echo 'count=0' >> "$GITHUB_OUTPUT"
echo "No submodules declared in .gitmodules — nothing to release."
exit 0
fi
matrix="$(printf '%s\n' ${paths} | jq -R . | jq -cs '{module_path: .}')"
count="$(printf '%s\n' ${paths} | wc -l | tr -d ' ')"
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT"
echo "count=${count}" >> "$GITHUB_OUTPUT"
echo "Discovered ${count} module(s):"
printf ' %s\n' ${paths}
release:
needs: discover
if: ${{ needs.discover.outputs.count != '0' }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.discover.outputs.matrix) }}
uses: ./.github/workflows/_release-module.yml
with:
module_path: ${{ matrix.module_path }}
force_build: ${{ inputs.force_build }}
secrets: inherit