fix all workflows: use env vars for python f-strings

This commit is contained in:
2026-03-09 16:20:03 +00:00
parent a377ba9d2c
commit b35d617b31
3 changed files with 12 additions and 6 deletions
-2
View File
@@ -1,8 +1,6 @@
name: handy update name: handy update
on: on:
push:
branches: [main]
schedule: schedule:
- cron: "40 6 * * *" - cron: "40 6 * * *"
workflow_dispatch: workflow_dispatch:
+6 -2
View File
@@ -57,12 +57,16 @@ jobs:
url="https://github.com/imputnet/helium-linux/releases/download/${latest_version}/helium-${latest_version}-x86_64.AppImage" url="https://github.com/imputnet/helium-linux/releases/download/${latest_version}/helium-${latest_version}-x86_64.AppImage"
new_hash=$(nix store prefetch-file --json "$url" | python -c 'import json,sys; print(json.load(sys.stdin)["hash"])') new_hash=$(nix store prefetch-file --json "$url" | python -c 'import json,sys; print(json.load(sys.stdin)["hash"])')
export LATEST_VERSION="$latest_version"
export NEW_HASH="$new_hash"
python - <<PY python - <<PY
import re import re
import os
p='modules/pkgs/helium.nix' p='modules/pkgs/helium.nix'
s=open(p).read() s=open(p).read()
s=re.sub(r'version\s*=\s*"[^"]+"', f'version = "{latest_version}"', s, count=1) s=re.sub(r'version\s*=\s*"[^"]+"', f'version = "{os.environ["LATEST_VERSION"]}"', s, count=1)
s=re.sub(r'hash\s*=\s*"[^"]+"', f'hash = "{new_hash}"', s, count=1) s=re.sub(r'hash\s*=\s*"[^"]+"', f'hash = "{os.environ["NEW_HASH"]}"', s, count=1)
open(p,'w').write(s) open(p,'w').write(s)
PY PY
+6 -2
View File
@@ -55,12 +55,16 @@ jobs:
url="https://github.com/zen-browser/desktop/releases/download/${latest_version}/zen-x86_64.AppImage" url="https://github.com/zen-browser/desktop/releases/download/${latest_version}/zen-x86_64.AppImage"
new_hash=$(nix store prefetch-file --json "$url" | python -c 'import json,sys; print(json.load(sys.stdin)["hash"])') new_hash=$(nix store prefetch-file --json "$url" | python -c 'import json,sys; print(json.load(sys.stdin)["hash"])')
export LATEST_VERSION="$latest_version"
export NEW_HASH="$new_hash"
python - <<PY python - <<PY
import re import re
import os
p='modules/pkgs/zen-browser.nix' p='modules/pkgs/zen-browser.nix'
s=open(p).read() s=open(p).read()
s=re.sub(r'version\s*=\s*"[^"]+"', f'version = "{latest_version}"', s, count=1) s=re.sub(r'version\s*=\s*"[^"]+"', f'version = "{os.environ["LATEST_VERSION"]}"', s, count=1)
s=re.sub(r'hash\s*=\s*"[^"]+"', f'hash = "{new_hash}"', s, count=1) s=re.sub(r'hash\s*=\s*"[^"]+"', f'hash = "{os.environ["NEW_HASH"]}"', s, count=1)
open(p,'w').write(s) open(p,'w').write(s)
PY PY