Skip to content

Commit 95f636d

Browse files
fix(ci): extract version from tag manually since build process modifies package.json causing subsequent builds to be in a dirty state
1 parent 0e3b1df commit 95f636d

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ jobs:
2525
fetch-depth: 0
2626
submodules: recursive
2727

28+
- name: Get version
29+
id: version
30+
shell: bash
31+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
32+
2833
- name: Install pnpm
2934
uses: pnpm/action-setup@v2
3035
with:
@@ -55,6 +60,7 @@ jobs:
5560
CIBW_SKIP: "cp37-* cp38-* cp39-* cp310-*"
5661
CIBW_ARCHS: "auto64"
5762
CIBW_BUILD_FRONTEND: "build"
63+
CIBW_ENVIRONMENT: "SETUPTOOLS_SCM_PRETEND_VERSION=${{ steps.version.outputs.VERSION }}"
5864
# Linux builds run in a container, so we need to install Rust inside it.
5965
CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y"
6066
CIBW_ENVIRONMENT_LINUX: 'PATH="$HOME/.cargo/bin:$PATH"'
@@ -78,6 +84,11 @@ jobs:
7884
fetch-depth: 0
7985
submodules: recursive
8086

87+
- name: Get version
88+
id: version
89+
shell: bash
90+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
91+
8192
- name: Install pnpm
8293
uses: pnpm/action-setup@v2
8394
with:
@@ -103,6 +114,8 @@ jobs:
103114
- name: Build sdist
104115
run: uv build --sdist
105116
working-directory: pywire
117+
env:
118+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.version.outputs.VERSION }}
106119

107120
- uses: actions/upload-artifact@v4
108121
with:
@@ -127,4 +140,4 @@ jobs:
127140
- name: Publish
128141
uses: pypa/gh-action-pypi-publish@release/v1
129142
with:
130-
packages-dir: dist/
143+
packages-dir: dist/

0 commit comments

Comments
 (0)