diff --git a/.github/workflows/create_archive.py b/.github/workflows/create_archive.py new file mode 100644 index 0000000..9e8b80e --- /dev/null +++ b/.github/workflows/create_archive.py @@ -0,0 +1,16 @@ +from pathlib import Path +import hashlib +import platform +import shutil + +# Create archive +shutil.make_archive("dist/gistim", "zip", "dist/gistim") + +# Create a checksum +path = Path("dist/gistim.zip") +with open(path, "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" +path.rename(filename) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..51b54ca --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: release + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ${{ matrix.os }} + matrix: + os: + - ubuntu-latest + - macOS-latest + - windows-latest + steps: + - name: Check out repo + uses: actions/checkout@v4 + - name: Setup Pixi + uses: prefix-dev/setup-pixi@v0.4.1 + - name: Build with PyInstaller + run: pixi run build-backend + - name: Create ZIP Archive + run: pixi run create-archive + - name: Upload archive + uses: softprops/action-gh-release@v1 + with: + files: *.zip diff --git a/pixi.toml b/pixi.toml index 89af3ee..1273a7b 100644 --- a/pixi.toml +++ b/pixi.toml @@ -13,6 +13,7 @@ repository = "https://github.com/Deltares/qgis-tim" [tasks] install = "pip install --no-deps --editable ." build-backend = "pyinstaller gistim/__main__.py --name gistim" +create-archive = "python .github/workflows/create_archive.py" [dependencies] python = "3.11"