1+ name : Create Release PR (select images)
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ dirs :
7+ description : ' Comma-separated app dirs to promote (e.g. salamicontainers/salami/valkey/8,salamicontainers/salami/other/1)'
8+ required : true
9+
10+ permissions :
11+ contents : write
12+ pull-requests : write
13+
14+ jobs :
15+ plan :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v4
19+ with :
20+ ref : dev
21+ fetch-depth : 0
22+
23+ - name : Build release plan
24+ id : plan
25+ shell : bash
26+ run : |
27+ set -euo pipefail
28+ IFS=, read -r -a ARR <<<"${{ github.event.inputs.dirs }}"
29+ includes="[]"
30+ for d in "${ARR[@]}"; do
31+ d="${d//[$'\n\r\t ']/}"
32+ [ -n "$d" ] || continue
33+ if [ ! -f "$d/Dockerfile" ]; then
34+ echo "Skip: $d (no Dockerfile)" >&2
35+ continue
36+ fi
37+ if [ ! -f "$d/VERSION" ]; then
38+ echo "Skip: $d (no VERSION)" >&2
39+ continue
40+ fi
41+ ver="$(tr -d '\n\r\t ' < "$d/VERSION")"
42+ major="$(basename "$d")"
43+ app="$(basename "$(dirname "$d")")"
44+ image="ghcr.io/${{ github.repository_owner }}/salami-${app}-${major}"
45+ # Tags to publish on main: version and latest
46+ tags="${image}:${ver},${image}:latest"
47+ includes="$(jq -c --arg dir "$d" --arg img "$image" --arg ver "$ver" --arg tags "$tags" \
48+ '. + [{dir:$dir,image:$img,version:$ver,tags:$tags}]' <<<"$includes")"
49+ done
50+ mkdir -p .github/releases
51+ jq -c '{include: .}' <<<"$includes" > .github/releases/release-plan.json
52+ echo "plan=$(cat .github/releases/release-plan.json)" >> "$GITHUB_OUTPUT"
53+
54+ - name : Create PR dev -> main with release plan
55+ uses : peter-evans/create-pull-request@v6
56+ with :
57+ token : ${{ github.token }}
58+ commit-message : " chore(release): promote selected images"
59+ title : " Promote selected images to main"
60+ body : |
61+ This PR promotes the following images:
62+ ```
63+ ${{ steps.plan.outputs.plan }}
64+ ```
65+ branch : " promote/${{ github.run_id }}"
66+ base : main
67+ labels : promote
0 commit comments