Repository navigation
96 lines (92 loc) · 4.39 KB
/
Copy pathrelease-notes.yml
File metadata and controls
96 lines (92 loc) · 4.39 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: "Release Notes: Generate"
# Generate release notes for any commit range with Claude, on demand, independent of a
# release. Output goes to the run Step Summary and downloadable artifacts for review. It
# overwrites a release body only if you tick "apply-to-release" (off by default). The
# generation itself lives in the shared release-notes-apply.yml reusable workflow.
on:
workflow_dispatch:
inputs:
to:
description: Range end (tag/SHA/branch). Defaults to HEAD.
required: false
default: ''
type: string
from:
description: Range start (tag/SHA). Defaults to the previous release of the same product before 'to'.
required: false
default: ''
type: string
apply-to-release:
description: Replace the notes on the existing release named by 'to'. Unticked, or if no such release exists, only generates a preview.
required: false
default: false
type: boolean
add-contributors:
description: Append GitHub's "New Contributors" section (repo-wide for the range).
required: false
default: true
type: boolean
docs-notes:
description: Use the written release notes from stride-docs (engine only). For a stable X.Y.0, master's notes also open the release body.
required: false
default: true
type: boolean
jobs:
# Detect the product from the 'to' tag prefix (releases/ cli/ vspackage/ launcher/); a
# SHA/branch/HEAD (no product prefix) is treated as the engine. Also validate the apply
# target: applying needs 'to' to be an EXISTING release tag (releases are keyed by tag, so a
# SHA can't be applied to); otherwise generate without applying.
Config:
runs-on: ubuntu-latest
outputs:
product: ${{ steps.cfg.outputs.product }}
tag-match: ${{ steps.cfg.outputs.tag-match }}
scope: ${{ steps.cfg.outputs.scope }}
apply-tag: ${{ steps.cfg.outputs.apply-tag }}
docs-notes: ${{ steps.cfg.outputs.docs-notes }}
steps:
- id: cfg
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# No checkout here, so gh cannot infer the repo and every `gh release view` fails.
GH_REPO: ${{ github.repository }}
TO: ${{ inputs.to }}
APPLY: ${{ inputs.apply-to-release }}
DOCS_NOTES: ${{ inputs.docs-notes }}
run: |
case "$TO" in
cli/*) P="the Stride CLI"; M="cli/*"; S="sources/launcher/Stride.Cli" ;;
vspackage/*) P="the Stride Visual Studio package"; M="vspackage/*"; S="sources/tools/Stride.VisualStudio.*" ;;
launcher/*) P="the Stride Launcher"; M="launcher/*"; S="sources/launcher/Stride.Launcher" ;;
*) P="the Stride engine"; M="releases/*"; S=". :(exclude)sources/launcher/Stride.Cli :(exclude)sources/tools/Stride.VisualStudio.* :(exclude)sources/launcher/Stride.Launcher" ;;
esac
# stride-docs only has release notes for the engine.
case "$M" in releases/*) D="$DOCS_NOTES" ;; *) D=false ;; esac
APPLY_TAG=""
if [ "$APPLY" = "true" ]; then
if [ -n "$TO" ] && gh release view "$TO" >/dev/null 2>&1; then
APPLY_TAG="$TO"
else
echo "::warning::apply-to-release is on, but '$TO' is not an existing release tag; generating without applying."
fi
fi
{ echo "product=$P"; echo "tag-match=$M"; echo "scope=$S"; echo "apply-tag=$APPLY_TAG"; echo "docs-notes=$D"; } >> "$GITHUB_OUTPUT"
Notes:
needs: Config
permissions:
contents: read # passed down only as the model's read-only token; apply uses the PAT
pull-requests: read # let the model trace commits to their PRs
uses: ./.github/workflows/release-notes-apply.yml
with:
to: ${{ inputs.to }}
from: ${{ inputs.from }}
tag: ${{ needs.Config.outputs.apply-tag }}
tag-match: ${{ needs.Config.outputs.tag-match }}
product: ${{ needs.Config.outputs.product }}
scope: ${{ needs.Config.outputs.scope }}
apply: ${{ needs.Config.outputs.apply-tag != '' }}
add-contributors: ${{ inputs.add-contributors }}
docs-notes: ${{ needs.Config.outputs.docs-notes == 'true' }}
secrets:
gh-token: ${{ secrets.GH_PAT }} # write-capable PAT: shell reads + apply (model uses the read-only GITHUB_TOKEN)
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}