-
-
Notifications
You must be signed in to change notification settings - Fork 1
114 lines (109 loc) · 3.77 KB
/
Copy pathprepare-release.yml
File metadata and controls
114 lines (109 loc) · 3.77 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Prepare Release
on:
workflow_dispatch:
inputs:
version:
description: Stable semantic version
required: true
release_branch:
description: Trusted release/* branch
required: true
mode:
type: choice
options: [check, prepare]
default: check
concurrency:
group: prepare-release-${{ inputs.release_branch }}-${{ inputs.version }}
cancel-in-progress: false
permissions: {}
jobs:
check:
if: inputs.mode == 'check'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.release_branch }}
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Validate trusted ref
env:
BRANCH: ${{ inputs.release_branch }}
VERSION: ${{ inputs.version }}
run: |
python - <<'PY'
import os, re
branch, version = os.environ['BRANCH'], os.environ['VERSION']
if not re.fullmatch(r'release/[A-Za-z0-9._-]+', branch):
raise SystemExit('check ref must be a release/* branch')
if not re.fullmatch(r'\d+\.\d+\.\d+', version):
raise SystemExit('version must be stable SemVer')
PY
- run: python -m pip install build pyyaml
- name: Candidate bootstrap
run: >-
python scripts/release_bootstrap.py check
--version ${{ inputs.version }}
--manifest "${{ runner.temp }}/closure.json"
- name: Clean second pass
run: >-
python scripts/release_bootstrap.py check
--version ${{ inputs.version }}
--manifest "${{ runner.temp }}/closure-second-pass.json"
- uses: actions/upload-artifact@v7
with:
name: release-closure-${{ inputs.version }}-check
path: ${{ runner.temp }}/closure*.json
prepare:
if: inputs.mode == 'prepare'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.release_branch }}
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Validate trusted ref
env:
BRANCH: ${{ inputs.release_branch }}
VERSION: ${{ inputs.version }}
run: |
python - <<'PY'
import os, re
branch, version = os.environ['BRANCH'], os.environ['VERSION']
if not re.fullmatch(r'release/[A-Za-z0-9._-]+', branch):
raise SystemExit('prepare ref must be a release/* branch')
if not re.fullmatch(r'\d+\.\d+\.\d+', version):
raise SystemExit('version must be stable SemVer')
PY
- run: python -m pip install build pyyaml
- name: Candidate bootstrap
run: >-
python scripts/release_bootstrap.py prepare
--version ${{ inputs.version }}
--manifest "${{ runner.temp }}/closure.json"
- name: Constrain and commit generated changes
env:
VERSION: ${{ inputs.version }}
run: |
python scripts/release_status_guard.py
git add docs .specsmith/requirements.json .specsmith/testcases.json
git diff --cached --quiet || git commit -m "chore(release): close Specsmith v${VERSION} bootstrap"
git push origin HEAD:${{ inputs.release_branch }}
- name: Clean second pass
run: >-
python scripts/release_bootstrap.py check
--version ${{ inputs.version }}
--manifest "${{ runner.temp }}/closure-second-pass.json"
- uses: actions/upload-artifact@v7
with:
name: release-closure-${{ inputs.version }}-prepare
path: ${{ runner.temp }}/closure*.json