Skip to content

Commit 6baf007

Browse files
committed
Merge remote-tracking branch 'origin/main' into sync/main-into-develop-pr-315
2 parents 51d9e01 + ab4d549 commit 6baf007

File tree

4 files changed

+66
-19
lines changed

4 files changed

+66
-19
lines changed

.github/workflows/canary-release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Canary Release
2+
on:
3+
push:
4+
# don't run on tags, run on commits
5+
# https://github.com/orgs/community/discussions/25615
6+
tags-ignore:
7+
- "**"
8+
branches:
9+
- develop
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
concurrency:
17+
group: canary-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
compute_canary_version:
22+
runs-on: ubuntu-24.04
23+
outputs:
24+
version: ${{ steps.canary_version.outputs.version }}
25+
steps:
26+
- name: Compute canary version
27+
id: canary_version
28+
run: |
29+
SHORT_SHA=${GITHUB_SHA::7}
30+
DATE=$(date -u +%Y%m%dT%H%M%SZ)
31+
echo "version=canary-${DATE}-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
32+
33+
release_container:
34+
needs: compute_canary_version
35+
uses: ./.github/workflows/release-container.yml
36+
with:
37+
version: ${{ needs.compute_canary_version.outputs.version }}
38+
secrets: inherit

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- "**"
88
branches:
99
- main
10+
- develop
1011
pull_request:
1112
workflow_dispatch:
1213

.github/workflows/prep-release.yml

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ on:
1616
custom_version:
1717
type: string
1818
required: false
19-
description: "Custom version (ignore for other bump types)"
20-
generate_pre_release:
21-
type: boolean
22-
default: true
23-
required: true
24-
description: "Generate a RC build"
19+
description: "Custom version (ignored for other bump types)"
2520

2621
permissions:
2722
contents: write
@@ -75,11 +70,14 @@ jobs:
7570
env:
7671
CURR: ${{ steps.meta.outputs.current_version }}
7772
CUSTOM: ${{ inputs.custom_version }}
78-
BUMP: ${{ inputs.bump }}
73+
BUMP: ${{ inputs.version_bump }}
7974
run: |
8075
set -euo pipefail
8176
82-
if [[ -n "${CUSTOM:-}" ]]; then then
77+
if [[ -n "${CUSTOM:-}" ]]; then
78+
echo "new_version=$CUSTOM" >> "$GITHUB_OUTPUT"
79+
echo "Custom Bumped: $CURR -> $CUSTOM"
80+
else
8381
# strip any pre-release / build metadata for arithmetic (e.g., -rc.1, +build.5)
8482
BASE="${CURR%%[-+]*}"
8583
@@ -95,9 +93,6 @@ jobs:
9593
NEW_VERSION="$MA.$MI.$PA"
9694
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
9795
echo "Bumped: $CURR -> $NEW_VERSION"
98-
else
99-
echo "new_version=$CUSTOM" >> "$GITHUB_OUTPUT"
100-
echo "Bumped: $CURR -> $CUSTOM"
10196
fi
10297
10398
- name: Prepare release branch
@@ -119,26 +114,32 @@ jobs:
119114
NEW_VERSION: ${{ steps.bump.outputs.new_version }}
120115
run: |
121116
python3 - <<'PY'
117+
try:
122118
import os, re, sys, glob, pathlib
123-
119+
124120
current_version = os.environ["CURR_VERSION"]
125121
new_version = os.environ["NEW_VERSION"]
126-
122+
123+
print(f"current={current_version} new={new_version}")
124+
127125
# negative lookbehind (word,., or -) + optional 'v' + the escaped current version + negative lookahead (word or .)
128126
# e.g. current version of 1.0.1 will match 1.0.1, v1.0.1, v1.0.1-rc.1
129127
# e.g. current version of 1.0.1 will not match ver1.0.1, 1.0.1x, 1.0.11, 1.0.1.beta
130128
pat = re.compile(rf'(?<![\w.-])(v?){re.escape(current_version)}(?![\w.])')
131-
129+
132130
def repl(m): # preserve 'v' prefix if it existed
133131
return (m.group(1) or '') + new_version
134-
132+
135133
# Targets to update
136134
targets = [
137135
"scripts/nix/install.sh", # nix shell script
138136
"scripts/windows/install.ps1", # PowerShell
139137
*glob.glob("**/*.mdx", recursive=True), # docs
140138
]
141-
139+
140+
print(targets)
141+
print(f"Scanning {len(targets)} targets…")
142+
142143
changed = 0
143144
for path in targets:
144145
p = pathlib.Path(path)
@@ -150,9 +151,14 @@ jobs:
150151
p.write_text(new_txt, encoding="utf-8")
151152
print(f"Updated {path} ({n} occurrence{'s' if n!=1 else ''})")
152153
changed += n
153-
154+
154155
if changed == 0:
155-
sys.exit("::warning::No occurrences of the current version were found.")
156+
print("::error::No occurrences of the current version were found.", file=sys.stderr)
157+
sys.exit(1)
158+
except Exception:
159+
import traceback
160+
traceback.print_exc()
161+
sys.exit(1)
156162
PY
157163

158164
- name: Push changes to release branch

.github/workflows/release-container.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ on:
55
- "v[0-9]+.[0-9]+.[0-9]+"
66
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
77
workflow_dispatch:
8-
inputs:
8+
inputs: &release_inputs
99
version:
1010
description: Version to publish
1111
required: true
1212
type: string
13+
workflow_call:
14+
inputs: *release_inputs
1315

1416
env:
1517
REGISTRY: ghcr.io

0 commit comments

Comments
 (0)