Adding Windows support #34
Workflow file for this run
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 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..." | |
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." | |
echo "upload_url=https://uploads.github.com/repos/${{ github.repository }}/releases/$(jq -r .id response.json)/assets{?name,label}" >> $GITHUB_ENV | |
- name: Upload macOS Build Artifact | |
run: | | |
echo "Uploading macOS artifact..." | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: application/zip" \ | |
--data-binary @"${{ needs.build-macos.outputs.mac_zip }}" \ | |
"${{ env.upload_url }}&name=Mastermind-mac.zip" | |
echo "macOS artifact uploaded." | |
- name: Upload Windows Build Artifact | |
run: | | |
echo "Uploading Windows artifact..." | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: application/zip" \ | |
--data-binary @"${{ needs.build-windows.outputs.win_zip }}" \ | |
"${{ env.upload_url }}&name=Mastermind-win.zip" | |
echo "Windows artifact uploaded." |