Skip to content

Commit a041c59

Browse files
committed
release: v1.9.15
1 parent 3ad79ac commit a041c59

11 files changed

Lines changed: 992 additions & 214 deletions

File tree

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 1
18+
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- uses: astral-sh/setup-uv@v6
24+
with:
25+
enable-cache: true
26+
27+
- run: uv sync --all-extras --no-cache --upgrade
28+
- run: uv build
29+
- name: Publish package
30+
env:
31+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_PAT_SECRET }}
32+
run: |
33+
if [[ -n "${UV_PUBLISH_TOKEN:-}" ]]; then
34+
uv publish
35+
else
36+
uv publish --trusted-publishing always
37+
fi

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release State
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
id-token: write
12+
13+
jobs:
14+
release-state:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
ref: ${{ github.ref_name }}
21+
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- uses: astral-sh/setup-uv@v6
27+
with:
28+
enable-cache: true
29+
30+
- name: Configure git identity
31+
run: |
32+
git config user.name "github-actions[bot]"
33+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
34+
35+
- name: Run release script
36+
env:
37+
GH_TOKEN: ${{ github.token }}
38+
run: ./bin/release.sh

abx_pkg/binprovider.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@
8686
UNKNOWN_ABSPATH = Path("/usr/bin/true")
8787
UNKNOWN_VERSION = cast(SemVer, SemVer.parse("999.999.999"))
8888

89+
90+
def env_flag_is_true(name: str) -> bool:
91+
return os.getenv(name, "").strip().lower() in {"1", "true", "yes", "on"}
92+
93+
8994
################## VALIDATORS #######################################
9095

9196
NEVER_CACHE = (
@@ -409,6 +414,10 @@ def EUID(self) -> int:
409414

410415
return self.detect_euid()
411416

417+
@property
418+
def DRY_RUN(self) -> bool:
419+
return self._dry_run or env_flag_is_true("DRY_RUN")
420+
412421
@computed_field
413422
@property
414423
def INSTALLER_BIN_ABSPATH(self) -> HostBinPath | None:
@@ -856,7 +865,7 @@ def exec(
856865
f"cwd must be a valid, accessible directory: {cwd}"
857866
)
858867
cmd = [str(bin_abspath), *(str(arg) for arg in cmd)]
859-
if self._dry_run:
868+
if self.DRY_RUN:
860869
logger.info(
861870
"DRY RUN (%s): %s",
862871
self.__class__.__name__,
@@ -883,7 +892,7 @@ def drop_privileges():
883892
except Exception:
884893
pass
885894

886-
if self._dry_run:
895+
if self.DRY_RUN:
887896
return subprocess.CompletedProcess(cmd, 0, "", "skipped (dry run)")
888897

889898
return subprocess.run(
@@ -1103,7 +1112,7 @@ def install(
11031112
if not quiet:
11041113
raise
11051114

1106-
if self._dry_run:
1115+
if self.DRY_RUN:
11071116
# return fake ShallowBinary if we're just doing a dry run
11081117
# no point trying to get real abspath or version if nothing was actually installed
11091118
return ShallowBinary.model_validate(
@@ -1200,7 +1209,7 @@ def update(
12001209
if not quiet:
12011210
raise
12021211

1203-
if self._dry_run:
1212+
if self.DRY_RUN:
12041213
return ShallowBinary.model_validate(
12051214
{
12061215
"name": bin_name,
@@ -1289,7 +1298,7 @@ def uninstall(
12891298

12901299
self.invalidate_cache(bin_name)
12911300

1292-
if self._dry_run:
1301+
if self.DRY_RUN:
12931302
return True
12941303

12951304
if uninstall_result is not False:

0 commit comments

Comments
 (0)