Skip to content

Adding Windows support #33

Adding Windows support

Adding Windows support #33

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*.*.*' # Triggert auf Tags wie v1.0.0, v1.0.1, etc.
permissions:
contents: write
jobs:
build-macos:
runs-on: macos-latest
outputs:
mac_zip: ${{ steps.upload_macos.outputs.artifact_path }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install Dependencies
run: python -m pip install -r requirements.txt
- name: Run Build Script for macOS
run: |
echo "Starting macOS build script..."
python build_script_macos.py
echo "Building macOS ZIP file..."
cd dist
zip -r Mastermind-mac.zip Mastermind.app
echo "macOS ZIP file created at $(pwd)/Mastermind-mac.zip"
echo "artifact_path=$(pwd)/Mastermind-mac.zip" >> $GITHUB_ENV
id: upload_macos
- name: List Files in dist (macOS)
run: |
echo "Listing files in dist directory..."
cd dist
ls -al
echo "macOS build completed."
build-windows:
runs-on: windows-latest
outputs:
win_zip: ${{ steps.upload_windows.outputs.artifact_path }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install Dependencies
run: python -m pip install -r requirements.txt
- name: Run Build Script for Windows
run: |
echo "Starting Windows build script..."
python build_script_windows.py
echo "Building Windows ZIP file..."
cd dist
powershell Compress-Archive -Path Mastermind -DestinationPath Mastermind-win.zip
echo "Windows ZIP file created at $(pwd)/Mastermind-win.zip"
echo "artifact_path=$(pwd)/Mastermind-win.zip" >> $GITHUB_ENV
id: upload_windows
- name: List Files in dist (Windows)
run: |
echo "Listing files in dist directory..."
cd dist
dir
echo "Windows build completed."
create-release:
runs-on: ubuntu-latest
needs: [build-macos, build-windows]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Create Release
id: create_release
run: |
echo "Creating release..."
echo "Tag: ${{ github.ref }}"
echo "Release name: Release ${{ github.ref }}"
echo "Creating GitHub release..."
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"tag_name": "${{ github.ref }}", "name": "Release ${{ github.ref }}", "draft": false, "prerelease": false}' \
https://api.github.com/repos/${{ github.repository }}/releases
echo "Release created."
- name: Upload macOS Build Artifact
run: |
echo "Uploading macOS artifact..."
echo "Upload URL: ${{ steps.create_release.outputs.upload_url }}"
echo "Asset path: ${{ needs.build-macos.outputs.mac_zip }}"
echo "Asset name: Mastermind-mac.zip"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ needs.build-macos.outputs.mac_zip }}
asset_name: Mastermind-mac.zip
asset_content_type: application/zip
- name: Upload Windows Build Artifact
run: |
echo "Uploading Windows artifact..."
echo "Upload URL: ${{ steps.create_release.outputs.upload_url }}"
echo "Asset path: ${{ needs.build-windows.outputs.win_zip }}"
echo "Asset name: Mastermind-win.zip"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ needs.build-windows.outputs.win_zip }}
asset_name: Mastermind-win.zip
asset_content_type: application/zip