name: Build ALL run-name: Build ALL on: workflow_dispatch: {} release: types: [published] jobs: Build_MacOS: runs-on: macos-15 steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: channel: "stable" flutter-version-file: pubspec.yaml architecture: x64 - run: sudo xcode-select --switch /Applications/Xcode_16.0.app - run: flutter pub get # Step 1: Decode and install the certificate - name: Decode and install certificate env: CERTIFICATE: ${{ secrets.CERTIFICATE }} CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} run: | echo "$CERTIFICATE" | base64 --decode > signing_certificate.p12 security import signing_certificate.p12 -k ~/Library/Keychains/login.keychain -P "$CERTIFICATE_PASSWORD" -T /usr/bin/codesign # Step 2: Build the Flutter macOS app - name: Build Flutter macOS App run: flutter build macos --release # Step 3: Create the DMG file - name: Create DMG run: | mkdir -p dist mkdir -p dist/dmg_contents cp -R build/macos/Build/Products/Release/venera.app dist/dmg_contents/ ln -s /Applications dist/dmg_contents/Applications hdiutil create -volname "venera" -srcfolder dist/dmg_contents -ov -format UDZO "dist/venera.dmg" - name: Add version to filename run: | APP_VERSION=$(grep "version:" pubspec.yaml | cut -d':' -f2 | tr -d ' ') mkdir -p result mv dist/venera.dmg result/venera-$APP_VERSION.dmg # Step 4: Attach and upload artifacts (optional) - name: Upload DMG uses: actions/upload-artifact@v4 with: name: macos_build path: result/ Build_IOS: runs-on: macos-15 steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: channel: "stable" flutter-version-file: pubspec.yaml architecture: x64 - run: sudo xcode-select --switch /Applications/Xcode_16.0.app - run: flutter pub get - run: flutter build ios --release --no-codesign - run: | mkdir -p /Users/runner/work/venera/venera/build/ios/iphoneos/Payload mv /Users/runner/work/venera/venera/build/ios/iphoneos/Runner.app /Users/runner/work/venera/venera/build/ios/iphoneos/Payload cd /Users/runner/work/venera/venera/build/ios/iphoneos/ zip -r venera-ios.ipa Payload - name: Add version to filename run: | APP_VERSION=$(grep "version:" pubspec.yaml | cut -d':' -f2 | tr -d ' ') mkdir -p result mv build/ios/iphoneos/venera-ios.ipa result/venera-ios-$APP_VERSION.ipa - uses: actions/upload-artifact@v4 with: name: ios_build path: result/ Build_Android: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: channel: "stable" flutter-version-file: pubspec.yaml architecture: x64 - name: Decode and install certificate env: STORE_FILE: ${{ secrets.ANDROID_KEYSTORE }} PROPERTY_FILE: ${{ secrets.ANDROID_KEY_PROPERTIES }} run: | echo "$STORE_FILE" | base64 --decode > android/keystore.jks echo "$PROPERTY_FILE" > android/key.properties - uses: actions/setup-java@v4 with: distribution: 'oracle' java-version: '17' - name: Setup Rust run: | rustup update rustup default stable - run: flutter pub get - run: flutter build apk --release - uses: actions/upload-artifact@v4 with: name: apks path: build/app/outputs/apk/release Build_Windows: runs-on: windows-latest steps: - uses: actions/checkout@v3 - name: install dependencies run: | choco install yq -y pip install httpx - uses: subosito/flutter-action@v2 with: channel: "stable" flutter-version-file: pubspec.yaml architecture: x64 - name: build run: | flutter pub get python windows/build.py - uses: actions/upload-artifact@v4 with: name: windows_build path: build/windows/Venera-* Build_Linux: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 with: channel: 'stable' flutter-version-file: pubspec.yaml architecture: x64 - run: | sudo apt-get update -y sudo apt-get install -y ninja-build libgtk-3-dev webkit2gtk-4.1 dart pub global activate flutter_to_debian - run: python3 debian/build.py x64 - run: dart run flutter_to_arch - run: | sudo rm -rf build/linux/arch/app.tar.gz sudo rm -rf build/linux/arch/pkg sudo rm -rf build/linux/arch/src sudo rm -rf build/linux/arch/PKGBUILD - name: Build AppImage run: | sudo apt-get install -y libfuse2 wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" chmod +x appimagetool mkdir -p Venera.AppDir cp -r build/linux/x64/release/bundle/* Venera.AppDir/ cat > Venera.AppDir/venera.desktop << EOF [Desktop Entry] Name=Venera Exec=venera Icon=venera Type=Application Categories=Utility; EOF cp assets/app_icon.png Venera.AppDir/venera.png cat > Venera.AppDir/AppRun << EOF #!/bin/sh HERE=\$(dirname \$(readlink -f "\${0}")) export PATH="\${HERE}"/usr/bin/:"\${HERE}"/usr/sbin/:"\${HERE}"/usr/games/:"\${HERE}"/bin/:"\${HERE}"/sbin/:\${PATH} export LD_LIBRARY_PATH="\${HERE}"/usr/lib/:\${LD_LIBRARY_PATH} export XDG_DATA_DIRS="\${HERE}"/usr/share/:\${XDG_DATA_DIRS} exec "\${HERE}"/venera "\$@" EOF chmod +x Venera.AppDir/AppRun APP_VERSION=$(grep "version:" pubspec.yaml | cut -d':' -f2 | tr -d ' ') ./appimagetool Venera.AppDir Venera-${APP_VERSION}-x86_64.AppImage mkdir -p build/linux/appimage mv Venera-${APP_VERSION}-x86_64.AppImage build/linux/appimage/ - uses: actions/upload-artifact@v4 with: name: appimage_build path: build/linux/appimage - uses: actions/upload-artifact@v4 with: name: deb_build path: build/linux/x64/release/debian - uses: actions/upload-artifact@v4 with: name: arch_build path: build/linux/arch/ Build_Linux_ARM64: runs-on: ubuntu-22.04-arm steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 with: channel: 'master' flutter-version-file: pubspec.yaml - run: | flutter pub get sudo apt-get update -y sudo apt-get install -y ninja-build libgtk-3-dev webkit2gtk-4.1 dart pub global activate flutter_to_debian - run: python3 debian/build.py arm64 - name: Build AppImage run: | sudo apt-get install -y libfuse2 wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-aarch64.AppImage" chmod +x appimagetool mkdir -p Venera.AppDir cp -r build/linux/arm64/release/bundle/* Venera.AppDir/ cat > Venera.AppDir/venera.desktop << EOF [Desktop Entry] Name=Venera Exec=venera Icon=venera Type=Application Categories=Utility; EOF cp assets/app_icon.png Venera.AppDir/venera.png cat > Venera.AppDir/AppRun << EOF #!/bin/sh HERE=\$(dirname \$(readlink -f "\${0}")) export PATH="\${HERE}"/usr/bin/:"\${HERE}"/usr/sbin/:"\${HERE}"/usr/games/:"\${HERE}"/bin/:"\${HERE}"/sbin/:\${PATH} export LD_LIBRARY_PATH="\${HERE}"/usr/lib/:\${LD_LIBRARY_PATH} export XDG_DATA_DIRS="\${HERE}"/usr/share/:\${XDG_DATA_DIRS} exec "\${HERE}"/venera "\$@" EOF chmod +x Venera.AppDir/AppRun APP_VERSION=$(grep "version:" pubspec.yaml | cut -d':' -f2 | tr -d ' ') ./appimagetool Venera.AppDir Venera-${APP_VERSION}-aarch64.AppImage mkdir -p build/linux/appimage mv Venera-${APP_VERSION}-aarch64.AppImage build/linux/appimage/ - uses: actions/upload-artifact@v4 with: name: appimage_arm64_build path: build/linux/appimage - uses: actions/upload-artifact@v4 with: name: deb_arm64_build path: build/linux/x64/release/debian # This is a bug related to flutter_to_debian, but it's not a big deal. Release: runs-on: ubuntu-22.04 needs: [Build_MacOS, Build_IOS, Build_Android, Build_Windows, Build_Linux, Build_Linux_ARM64] if: github.event_name == 'release' # 仅在 push 事件时执行 steps: - uses: actions/download-artifact@v4 with: name: macos_build path: outputs - uses: actions/download-artifact@v4 with: name: ios_build path: outputs - uses: actions/download-artifact@v4 with: name: apks path: outputs - uses: actions/download-artifact@v4 with: name: windows_build path: outputs - uses: actions/download-artifact@v4 with: name: deb_build path: outputs - uses: actions/download-artifact@v4 with: name: arch_build path: outputs - uses: actions/download-artifact@v4 with: name: deb_arm64_build path: outputs - uses: actions/download-artifact@v4 with: name: appimage_build path: outputs - uses: actions/download-artifact@v4 with: name: appimage_arm64_build path: outputs - uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} files: | outputs/*.ipa outputs/*.dmg outputs/*.apk outputs/*.zip outputs/*.exe outputs/*.deb outputs/*.zst outputs/*.AppImage env: GITHUB_TOKEN: ${{ secrets.ACTION_GITHUB_TOKEN }}