Skip to content

Updated Windows Implementation #20

Updated Windows Implementation

Updated Windows Implementation #20

Workflow file for this run

name: Release
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
create-release:
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ github.run_number }}"
release_name: Release ${{ github.run_number }}
draft: false
prerelease: false
body: "Description of the release goes here"
- name: Set Outputs
id: set_outputs
run: |
echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_ENV
electron-release:
needs: create-release
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ./electron-app
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20" # Specify the Node.js version based on your requirements
- name: Install dependencies
run: npm install
- name: Build and Publish
run: npm run release
- name: Get Release Asset Path
id: get_asset_path
run: |
asset_path=$(find ./dist -type f -name '*.AppImage')
echo "asset_path=$asset_path" >> $GITHUB_ENV
echo "asset_name=$(basename $asset_path)" >> $GITHUB_ENV
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./electron-app/dist/${{ env.asset_name }} # Uses the dynamically found file path
asset_name: ${{ env.asset_name }} # Uses the dynamically set asset name
asset_content_type: application/octet-stream
installer-release:
needs: create-release
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Nuitka
run: |
python -m pip install --upgrade pip
python -m pip install requests
python -m pip install nuitka
- name: Build Standalone Installer
run: |
python -m nuitka installer.py --standalone --onefile
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./installer.bin
asset_name: installer.bin
asset_content_type: application/octet-stream
electron-release-win:
needs: create-release
runs-on: windows-latest
defaults:
run:
working-directory: ./electron-app
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install dependencies
run: npm install
- name: Build and Package for Windows
run: npm run release
- name: Get Release Asset Path
id: get_asset_path
run: |
asset_path=$(find ./dist -type f -name '*.zip')
echo "asset_path=$asset_path" >> $GITHUB_ENV
echo "asset_name=$(basename $asset_path)" >> $GITHUB_ENV
shell: bash
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./electron-app/dist/${{ env.asset_name }}
asset_name: ${{ env.asset_name }}
asset_content_type: application/zip
installer-release-win:
needs: create-release
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Nuitka
run: |
python -m pip install --upgrade pip
python -m pip install cx_freeze requests tqdm
- name: Build Standalone Installer
env:
NUITKA_DOWNLOADS: yes
run: |
cxfreeze --script installer.py --target-dir dist
- name: Zip the output
run: |
powershell Compress-Archive -Path "dist\*" -DestinationPath "installer-win.zip"
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./installer-win.zip
asset_name: installer-win.zip
asset_content_type: application/octet-stream