Skip to content

Commit

Permalink
Multi-OS support
Browse files Browse the repository at this point in the history
  • Loading branch information
Huite committed Dec 17, 2023
1 parent f95e29b commit 941aa0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/create_archive.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from pathlib import Path
import hashlib
import os
import platform
import shutil

# Create archive
shutil.make_archive("dist/gistim", "zip", "dist/gistim")
# Use the RUNNER_OS variable on the Github Runner. Use platform system locally.
system = os.environ.get("RUNNER_OS", platform.system())
zippath = shutil.make_archive(f"dist/gistim-{system}", "zip", "dist/gistim")

# Create a checksum
path = Path("dist/gistim.zip")
with open(path, "rb", buffering=0) as f:
with open(zippath, "rb", buffering=0) as f:
sha256_hash = hashlib.file_digest(f, "sha256").hexdigest()

# Include it in the filename.
#filename = f"dist/gistim-{platform.system()}-{sha256_hash}.zip"
filename = f"dist/gistim-{platform.system()}.zip"
path.rename(filename)
with open(f"dist/sha256-checksum-{system}.txt", "w") as f:
f.write(sha256_hash)
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
steps:
- name: Check out repo
Expand All @@ -26,7 +28,7 @@ jobs:
- name: Create ZIP Archive
run: pixi run create-archive
- name: Release
run: gh release create ${{github.ref_name}} dist/gistim-Windows.zip
run: gh release upload ${{ github.ref_name }} dist/gistim-${{ RUNNER_OS }}.zip sha256-${{ RUNNER_OS }}.txt
env:
GITHUB_TOKEN: ${{ github.TOKEN }}

0 comments on commit 941aa0e

Please sign in to comment.