feat: Configure Node.js 24 for actions and enhance Windows build scri… #3
Workflow file for this run
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| build-macos: | |
| name: Build macOS (M-Series) | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Build macOS | |
| run: | | |
| flutter clean | |
| flutter build macos --release | |
| - name: Create DMG | |
| run: | | |
| APP_NAME="caption_trans" | |
| BUILD_PATH="build/macos/Build/Products/Release/${APP_NAME}.app" | |
| DMG_NAME="${APP_NAME}-macos-arm64.dmg" | |
| # Create temporary folder for DMG content | |
| mkdir -p dmg_content | |
| cp -R "$BUILD_PATH" dmg_content/ | |
| ln -s /Applications dmg_content/Applications | |
| # Create DMG | |
| hdiutil create -volname "$APP_NAME" -srcfolder dmg_content -ov -format UDZO "$DMG_NAME" | |
| # Clean up | |
| rm -rf dmg_content | |
| - name: Upload macOS Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-dmg | |
| path: caption_trans-macos-arm64.dmg | |
| build-windows: | |
| name: Build Windows | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Build Windows | |
| run: | | |
| flutter clean | |
| flutter build windows --release | |
| - name: Package Windows | |
| shell: pwsh | |
| run: | | |
| $APP_NAME = "caption_trans" | |
| $WORKSPACE = "${{ github.workspace }}" | |
| $BUILD_OUTPUT = Join-Path $WORKSPACE "build\windows\x64\runner\Release" | |
| $ZIP_NAME = Join-Path $WORKSPACE "${APP_NAME}-windows-x64.zip" | |
| Write-Host "Checking for build output at: $BUILD_OUTPUT" | |
| if (Test-Path $BUILD_OUTPUT) { | |
| Write-Host "Found release directory. Packaging..." | |
| Compress-Archive -Path "$BUILD_OUTPUT\*" -DestinationPath "$ZIP_NAME" -Force | |
| } else { | |
| Write-Host "!!! Error: Release directory not found at expected path !!!" | |
| Write-Host "Listing $WORKSPACE contents:" | |
| Get-ChildItem -Path $WORKSPACE -Recurse -Depth 3 | Select-Object FullName | |
| exit 1 | |
| } | |
| - name: Upload Windows Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-zip | |
| path: caption_trans-windows-x64.zip | |
| create-release: | |
| name: Create GitHub Release | |
| needs: [build-macos, build-windows] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| artifacts/*.dmg | |
| artifacts/*.zip | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |