Update: Optimize webview video resource obtaining #111
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: "pre-release" | |
on: | |
push: | |
branches: | |
- "main" | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: "Log level" | |
required: true | |
default: "warning" | |
jobs: | |
flutter-build-macos: | |
name: "Build MacOS" | |
runs-on: "macos-latest" | |
permissions: write-all | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
flutter-version-file: pubspec.yaml | |
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache | |
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path | |
pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies | |
pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path | |
- run: flutter pub get | |
- run: flutter build macos --release --verbose | |
- run: mkdir upload | |
- run: mv build/macos/Build/Products/Release/knkpanime.app upload/knkpanime-macOS.app | |
- run: ls | |
- name: Upload MacOS build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-build | |
path: upload | |
flutter-build-windows-android: | |
name: "Pre Release" | |
runs-on: "windows-latest" | |
permissions: write-all | |
needs: flutter-build-macos | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- run: git config --system core.longpaths true # to avoid file name too long error | |
- run: choco install yq | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
flutter-version-file: pubspec.yaml | |
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache | |
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path | |
pub-cache-key: "flutter-pub:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache of dart pub get dependencies | |
pub-cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "18" | |
- run: flutter pub get | |
- run: flutter build apk | |
- run: flutter build windows | |
- run: Compress-Archive -Path build/windows/x64/runner/Release -DestinationPath knkpanime-windows.zip | |
- name: Download MacOS build | |
uses: actions/download-artifact@v4 | |
with: | |
name: macos-build | |
- run: Compress-Archive -Path knkpanime-macOS.app -DestinationPath knkpanime-macOS.zip | |
- uses: r0adkll/sign-android-release@v1 | |
name: Sign app APK | |
id: sign_app | |
with: | |
releaseDirectory: build/app/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: "34.0.0" | |
- run: Ren ${{ steps.sign_app.outputs.signedReleaseFile }} knkpanime-android.apk | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "预览版" | |
files: | | |
knkpanime-windows.zip | |
build/app/outputs/apk/release/knkpanime-android.apk | |
knkpanime-macOS.zip | |
- name: Upload outputs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: outputs | |
path: | | |
knkpanime-windows.zip | |
build/app/outputs/apk/release/knkpanime-android.apk | |
knkpanime-macOS.zip |