name: Build MusicTools on: workflow_dispatch: push: tags: - 'v*' permissions: contents: write # serve per creare le Release jobs: # ========================================================= # macOS # ========================================================= build-macos: runs-on: macos-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install dependencies run: | pip install -r requirements.txt pip install pyinstaller - name: Install ffmpeg run: brew install ffmpeg - name: Build app run: python build_macos.py - name: Create DMG run: | STAGING="dmg_staging" rm -rf "$STAGING" mkdir -p "$STAGING" cp -R dist/MusicTools.app "$STAGING/" cp "assets/Fix Gatekeeper.command" "$STAGING/" chmod +x "$STAGING/Fix Gatekeeper.command" ln -s /Applications "$STAGING/Applications" cat > "$STAGING/LEGGIMI.txt" <<'EOF' INSTALLAZIONE MusicTools ======================== 1) Trascina MusicTools.app sulla cartella "Applicazioni" (l'alias e' qui dentro nel DMG) 2) Doppio click su "Fix Gatekeeper.command" Rimuove la quarantena macOS Gatekeeper (una sola volta). 3) Apri MusicTools dalle Applicazioni e attiva con email + chiave. Problemi? scrivici a info@djluza.com EOF hdiutil create -volname "MusicTools" -srcfolder "$STAGING" \ -ov -format UDZO MusicTools-macOS.dmg ls -lh MusicTools-macOS.dmg - name: Upload artifact uses: actions/upload-artifact@v4 with: name: MusicTools-macOS path: MusicTools-macOS.dmg retention-days: 14 # ========================================================= # Windows # ========================================================= build-windows: runs-on: windows-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.11' - name: Install dependencies run: | pip install -r requirements.txt pip install pyinstaller - name: Build exe run: python build_windows.py - name: Unblock files (rimuovi MOTW pre-zip) shell: pwsh run: | # Per ridurre l'incidenza del bug "Failed to resolve # Python.Runtime.Loader.Initialize" causato da Mark of the Web. Get-ChildItem -Path dist/MusicTools -Recurse -Include *.dll,*.exe,*.pyd ` | Unblock-File - name: Package -> zip shell: pwsh run: | Compress-Archive -Path dist/MusicTools/* -DestinationPath MusicTools-Windows.zip -CompressionLevel Optimal Get-Item MusicTools-Windows.zip - name: Upload artifact uses: actions/upload-artifact@v4 with: name: MusicTools-Windows path: MusicTools-Windows.zip retention-days: 14 # ========================================================= # Release (solo su tag v*) # ========================================================= release: needs: [build-macos, build-windows] if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest steps: - name: Download macOS artifact uses: actions/download-artifact@v4 with: name: MusicTools-macOS path: artifacts/macos - name: Download Windows artifact uses: actions/download-artifact@v4 with: name: MusicTools-Windows path: artifacts/windows - name: Create Release uses: softprops/action-gh-release@v2 with: name: MusicTools ${{ github.ref_name }} tag_name: ${{ github.ref_name }} generate_release_notes: true fail_on_unmatched_files: true files: | artifacts/macos/MusicTools-macOS.dmg artifacts/windows/MusicTools-Windows.zip