switched from older unmaintaned publishing action #10
This file contains hidden or 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 des Workflows (wird im GitHub Actions Tab angezeigt) | |
| name: Build for Windows | |
| # Wann soll der Workflow ausgeführt werden? | |
| on: | |
| push: | |
| branches: [ main ] # Ausführen bei jedem Push auf den main Branch | |
| tags: [ '*' ] # <-- Das sorgt dafür, dass auch bei jedem Tag der Workflow läuft! | |
| pull_request: | |
| branches: [ main ] # Ausführen bei jedem Pull Request auf den main Branch | |
| # Jobs, die ausgeführt werden sollen | |
| jobs: | |
| build: | |
| # Auf welchem Runner soll der Job laufen? Für Windows Executables brauchen wir Windows. | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write # Erlaubt dem Job, auf den Repository-Inhalt zuzugreifen notwendig für das Erstellen von Releases | |
| # Schritte des Jobs | |
| steps: | |
| - name: Code auschecken | |
| uses: actions/checkout@v4 # Holt den Code aus deinem Repository | |
| - name: Python einrichten | |
| # Richtet eine Python Umgebung ein. Wähle eine passende Version. | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' # Verwende die neueste Python 3 Version | |
| - name: Install Dependencies | |
| # Installiert Pygame und PyInstaller. | |
| # Wenn du eine requirements.txt hast, nutze: run: pip install -r requirements.txt | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pygame pyinstaller | |
| - name: Anwendung mit PyInstaller bauen | |
| # Führt den PyInstaller Befehl aus. | |
| # Pfad zu main.py muss korrekt sein relativ zum Root des ausgecheckten Codes. | |
| # Wenn du Assets hast, füge --add-data "pfad/zu/assets;assets" hinzu | |
| run: pyinstaller --onefile --windowed --name NodeGraphEditor main.py # Passe den Pfad zu main.py an, falls noetig | |
| # Release erstellen (nur bei Tag-Builds) | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| id: create_release | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # EXE zur Release-Seite hochladen (nur bei Tag-Builds) | |
| - name: Upload Release Asset | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: dist/NodeGraphEditor.exe | |
| asset_name: NodeGraphEditor.exe | |
| asset_content_type: application/octet-stream | |
| - name: Ausführbare Datei als Artifact hochladen | |
| # Speichert die gebaute .exe Datei, damit du sie herunterladen kannst. | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NodeGraphEditor-windows # Name des Artifacts | |
| path: dist/NodeGraphEditor.exe # Pfad zur gebauten Datei relativ zum Workspace | |
| retention-days: 5 # Wie lange das Artifact aufbewahrt werden soll |