Skip to content

fixed overflow error #11

fixed overflow error

fixed overflow error #11

Workflow file for this run

name: release
on:
push:
tags:
- "v*"
env:
BIN_NAME: mnemonic-hasher
jobs:
version-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify versions match tag
run: |
python - <<'PY'
import json, os, sys, re, pathlib
try:
import tomllib # Python 3.11+ on ubuntu-latest
except Exception as e:
print("Python >=3.11 required for tomllib", file=sys.stderr)
sys.exit(2)
tag = os.environ.get("GITHUB_REF_NAME","")
if not tag:
print("GITHUB_REF_NAME not set; are we on a tag ref?", file=sys.stderr)
sys.exit(2)
# Accept tags like v1.2.3 or 1.2.3 (keeps the numeric part)
m = re.fullmatch(r'v?(\d+\.\d+\.\d+(?:[-+].*)?)', tag)
if not m:
print(f"Tag '{tag}' doesn't look like a semver (vMAJOR.MINOR.PATCH[prerelease+build])", file=sys.stderr)
sys.exit(2)
tagver = m.group(1)
root = pathlib.Path(".")
errors = []
# package.json
pkg_path = root / "package.json"
try:
pkgver = json.loads(pkg_path.read_text())["version"]
except Exception as e:
print(f"Failed reading version from {pkg_path}: {e}", file=sys.stderr); sys.exit(2)
# tauri.conf.json (either at repo root or under src-tauri/)
tauri_path = root / "tauri.conf.json"
if not tauri_path.exists():
tauri_path = root / "src-tauri" / "tauri.conf.json"
try:
tauri = json.loads(tauri_path.read_text())
# Tauri can store version at package.version or top-level version
tauriver = (tauri.get("package") or {}).get("version") or tauri.get("version")
except Exception as e:
print(f"Failed reading version from {tauri_path}: {e}", file=sys.stderr); sys.exit(2)
# src-tauri/Cargo.toml (typical Tauri layout)
cargo_path = root / "src-tauri" / "Cargo.toml"
try:
cargover = tomllib.loads(cargo_path.read_text())["package"]["version"]
except Exception as e:
print(f"Failed reading version from {cargo_path}: {e}", file=sys.stderr); sys.exit(2)
# Report and compare
print(f"git tag : {tagver}")
print(f"package.json : {pkgver}")
print(f"Cargo.toml : {cargover}")
print(f"tauri.conf.json: {tauriver}")
mismatches = []
for name, v in [("package.json", pkgver), ("Cargo.toml", cargover), ("tauri.conf.json", tauriver)]:
if v != tagver:
mismatches.append((name, v))
if mismatches:
print("\nVersion mismatch detected:", file=sys.stderr)
for n, v in mismatches:
print(f" - {n}: {v} != {tagver}", file=sys.stderr)
sys.exit(1)
else:
print("\nAll versions match the tag.")
PY
build:
name: build (${{ matrix.os }} ${{ matrix.args }})
needs: version-check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux (x86_64)
- os: ubuntu-22.04
args: ""
# Windows (x86_64)
- os: windows-latest
args: ""
# macOS (Apple Silicon)
- os: macos-latest
args: "--target aarch64-apple-darwin"
# macOS (Intel)
- os: macos-latest
args: "--target x86_64-apple-darwin"
steps:
- uses: actions/checkout@v4
# Install pnpm
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
version: 20
cache: "pnpm"
# Install Rust toolchain + target
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
# Install both mac targets on macOS runners so we can cross-build each job quickly.
targets: ${{ matrix.os == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Install Windows build deps
if: runner.os == 'Windows'
shell: powershell
run: choco install -y rsync
- name: Install Linux build deps
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
# Tauri v2 needs webkit2gtk 4.1; patchelf is needed by the bundler.
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf rsync
# Install dependencies
- name: Install pnpm dependencies
run: pnpm install --frozen-lockfile
- name: Build & publish with tauri-action
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Workarounds for linuxdeploy quirks when stripping/using FUSE:
NO_STRIP: "1" # avoids strip failures on libs with .relr.dyn
APPIMAGE_EXTRACT_AND_RUN: "1" # runs AppImages without FUSE
with:
# Let the action create/find the release for this tag and upload artifacts.
tagName: v__VERSION__
releaseName: "scriptorium v__VERSION__"
releaseBody: "See the assets to download this version."
releaseDraft: false
prerelease: false
args: ${{ matrix.args }}
tauriScript: pnpm tauri
projectPath: .