Build Windows #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Windows | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up .NET SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Restore .NET dependencies | |
run: | | |
cd ModManagerCore | |
dotnet restore | |
- name: Build .NET project | |
run: | | |
cd ModManagerCore | |
dotnet build --configuration Release | |
- name: Publish .NET project | |
run: | | |
cd ModManagerCore | |
dotnet publish --configuration Release --output ../publish/Core | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies for Python | |
run: | | |
python -m pip install --upgrade pip | |
pip install PySide6 pyinstaller | |
- name: Build ModManagerGUI with PyInstaller | |
run: | | |
cd ModManagerGUI | |
pyinstaller --add-data "../publish/Core;Core" --name ModManagerGUI --windowed main.py | |
- name: Zip ModManagerGUI directory | |
run: | | |
cd ModManagerGUI\dist | |
powershell -Command "Compress-Archive -Path ModManagerGUI -DestinationPath ModManagerGUI_win.zip" | |
- name: Get the latest release upload URL | |
id: get_release | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const latestRelease = await github.rest.repos.getLatestRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
// Clean the URL and append the name query parameter | |
const cleanedUploadUrl = latestRelease.data.upload_url.split('{')[0]; | |
const finalUploadUrl = `${cleanedUploadUrl}?name=ModManagerGUI_win.zip`; // Append filename to the URL | |
core.setOutput('upload_url', finalUploadUrl); | |
- name: Upload ModManagerGUI artifact to release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ModManagerGUI\dist\ModManagerGUI_win.zip | |
asset_name: ModManagerGUI_win.zip | |
asset_content_type: application/zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |