Repository navigation
62 lines (56 loc) · 2.17 KB
/
Copy pathskills-release-prep.yml
File metadata and controls
62 lines (56 loc) · 2.17 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
name: Prepare skills release
on:
workflow_dispatch:
permissions:
contents: write
concurrency:
group: skills-release-prep
cancel-in-progress: false
jobs:
prepare:
name: Prepare skills release
if: github.ref == 'refs/heads/main' && github.triggering_actor == 'longquanzheng'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Assemble the skills fragments and push the release-prep branch
run: |
set -euo pipefail
release_date="$(date -u +%F)"
python3 script/release/changelog_fragments.py prepare skills --date "${release_date}"
version="$(tr -d '[:space:]' < skills/VERSION)"
# The run ID keeps the branch new when a later fragment needs another prep.
branch="release-prep/skills-v${version}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
git switch -c "${branch}"
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add -A skills changelog.d
git commit -m "Skills: release ${version}"
# GITHUB_TOKEN pull requests would not trigger Check Gate CI, so a person opens it.
git push origin "${branch}"
compare_url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/compare/main...${branch}?expand=1"
{
echo "## Skills release ${version}"
echo
echo "Pushed \`${branch}\`. Open its pull request with the \`release-prep\` label: ${compare_url}"
echo
echo '```text'
git show --stat --format='%s' HEAD
echo '```'
} >> "${GITHUB_STEP_SUMMARY}"
reject-non-main:
name: Reject non-main dispatch
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- run: |
echo "Skills releases are prepared only from main" >&2
exit 1
reject-non-owner:
name: Reject non-owner dispatch
if: github.triggering_actor != 'longquanzheng'
runs-on: ubuntu-latest
steps:
- run: |
echo "Skills releases need the owner's confirmation; only longquanzheng may dispatch this workflow" >&2
exit 1