Skip to content

Commit f76ba65

Browse files
committed
chore(build): enhanced version substitution
1 parent ea5b144 commit f76ba65

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,9 @@ jobs:
9393

9494
- name: Set version to include mypyc suffix
9595
run: |
96-
# Extract current version and add mypyc suffix
97-
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
98-
if [[ "${{ runner.os }}" == "macOS" ]]; then
99-
sed -i '' "s/version = \"$CURRENT_VERSION\"/version = \"$CURRENT_VERSION+mypyc\"/" pyproject.toml
100-
else
101-
sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$CURRENT_VERSION+mypyc\"/" pyproject.toml
102-
fi
96+
# Replace only the first version line (project version) with mypyc suffix
97+
sed -i.bak '1,20s/^version = "\([^"]*\)"/version = "\1+mypyc"/' pyproject.toml
98+
rm pyproject.toml.bak
10399
shell: bash
104100

105101
- name: Install dependencies with mypyc extras

.github/workflows/test-build.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,9 @@ jobs:
104104

105105
- name: Set version to include mypyc suffix
106106
run: |
107-
# Extract current version and add mypyc suffix
108-
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
109-
if [[ "${{ runner.os }}" == "macOS" ]]; then
110-
sed -i '' "s/version = \"$CURRENT_VERSION\"/version = \"$CURRENT_VERSION+mypyc\"/" pyproject.toml
111-
else
112-
sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$CURRENT_VERSION+mypyc\"/" pyproject.toml
113-
fi
107+
# Replace only the first version line (project version) with mypyc suffix
108+
sed -i.bak '1,20s/^version = "\([^"]*\)"/version = "\1+mypyc"/' pyproject.toml
109+
rm pyproject.toml.bak
114110
shell: bash
115111

116112
- name: Install dependencies with mypyc extras

0 commit comments

Comments
 (0)