From a429b8545eef87c81e3e9d8953b67a98f9e8a2bc Mon Sep 17 00:00:00 2001 From: csd4ni3l Date: Sun, 18 May 2025 15:46:04 +0200 Subject: [PATCH] Add releasing to nuitka action - zip before uploading to artifacts - new release step which downloads the artifacts, deletes the latest release and makes a new one --- .github/workflows/main.yml | 52 ++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2331f8c..d419482 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,14 @@ +name: Build and Release + on: push + jobs: build: + name: Build on ${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - - runs-on: ${{ matrix.os }} + os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Check-out repository @@ -14,15 +17,14 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax - architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified + python-version: '3.11' + architecture: 'x64' cache: 'pip' cache-dependency-path: | **/requirements*.txt - name: Install Dependencies - run: | - pip install -r requirements.txt + run: pip install -r requirements.txt - name: Build Executable uses: Nuitka/Nuitka-Action@main @@ -36,9 +38,37 @@ jobs: mode: standalone output-file: ShatterStack - - name: Upload Artifacts + - name: Zip Build Output + run: | + mkdir -p zip_output + zip -r "zip_output/ShatterStack-${{ runner.os }}.zip" build/ + + - name: Upload Zipped Build Artifact uses: actions/upload-artifact@v4 with: - name: ${{ runner.os }} Build - path: build/** - include-hidden-files: true + name: ShatterStack-${{ runner.os }} + path: zip_output/ShatterStack-${{ runner.os }}.zip + + release: + name: Create GitHub Release + needs: build + runs-on: ubuntu-latest + steps: + - name: Download All Zipped Builds + uses: actions/download-artifact@v4 + with: + path: downloads + + - name: Install GitHub CLI + uses: cli/cli-action@v2 + + - name: Delete Old Release (if exists) + continue-on-error: true + run: gh release delete latest -y + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create New "Latest Build" Release + run: gh release create latest downloads/**/ShatterStack-*.zip --title "Latest Build" --notes "Most recent multi-platform builds of ShatterStack" --prerelease + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}