Skip to content

Commit a15ae2b

Browse files
committed
chore: refine gh workflows for security and consistency
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 6f46783 commit a15ae2b

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/publish-pypi-release-aboutcode-pipeline.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
tags:
77
- "aboutcode.pipeline/*"
88

9+
env:
10+
PYPI_PROJECT_URL: "https://pypi.org/p/aboutcode.pipeline"
11+
PYPROJECT_TOML: "pipeline-pyproject.toml"
12+
FLOT_VERSION: "0.7.2"
13+
914
jobs:
1015
build:
1116
name: Build and publish library to PyPI
@@ -24,10 +29,10 @@ jobs:
2429
python-version: 3.14
2530

2631
- name: Install flot
27-
run: python -m pip install flot==0.7.2 --user
32+
run: python -m pip install "flot==${FLOT_VERSION}" --user
2833

2934
- name: Build a binary wheel and a source tarball
30-
run: python -m flot --pyproject pipeline-pyproject.toml --sdist --wheel --output-dir dist/
35+
run: python -m flot --pyproject "$PYPROJECT_TOML" --sdist --wheel --output-dir dist/
3136

3237
- name: Upload package distributions as GitHub workflow artifacts
3338
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
@@ -36,7 +41,7 @@ jobs:
3641
path: dist/
3742

3843
# Only set the id-token: write permission in the job that does publishing, not globally.
39-
# Also, separate building from publishing this makes sure that any scripts
44+
# Also, separate building from publishing, this makes sure that any scripts
4045
# maliciously injected into the build or test environment won't be able to elevate
4146
# privileges while flying under the radar.
4247
pypi-publish:
@@ -47,7 +52,7 @@ jobs:
4752
runs-on: ubuntu-24.04
4853
environment:
4954
name: pypi
50-
url: https://pypi.org/p/aboutcode.pipeline
55+
url: ${{ env.PYPI_PROJECT_URL }}
5156
permissions:
5257
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
5358

.github/workflows/publish-pypi-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
python-version: 3.14
2929

3030
- name: Install pypa/build
31-
run: python -m pip install build --user
31+
run: python -m pip install build==1.4.0 --user
3232

3333
- name: Build a binary wheel and a source tarball
3434
run: python -m build --sdist --wheel --outdir dist/
@@ -40,7 +40,7 @@ jobs:
4040
path: dist/
4141

4242
# Only set the id-token: write permission in the job that does publishing, not globally.
43-
# Also, separate building from publishing this makes sure that any scripts
43+
# Also, separate building from publishing, this makes sure that any scripts
4444
# maliciously injected into the build or test environment won't be able to elevate
4545
# privileges while flying under the radar.
4646
pypi-publish:

0 commit comments

Comments
 (0)