Skip to content

feat: add extension locally #162

feat: add extension locally

feat: add extension locally #162

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Dev Build CI
on:
push:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
env:
FLUTTER_VERSION: '3.44.0'
GO_VERSION: '1.26.3'
jobs:
build-and-release-android:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '${{ env.GO_VERSION }}'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
- uses: dtolnay/rust-toolchain@stable
- name: Add Android targets
run: rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android
- name: Decode keystore
run: |
echo $ENCODED_KEYSTORE | base64 -di > android/app/keystore.jks
env:
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE }}
- name: Create AAR directory
run: mkdir src/miru_core/android
- name: Install gomobile
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
go get golang.org/x/mobile/bind
gomobile version || true
gomobile init
working-directory: ./src/miru_core/miru-core
- name: Build Android AAR (gomobile bind)
working-directory: src/miru_core/miru-core/binary
run: |
gomobile bind -tags nosqlite -ldflags="-s -w -checklinkname=0" -o ../../android/libmiru-core.aar -target=android -androidapi 28
- run: flutter pub get
# 打包apk
- name: Collect Apks
run: flutter build apk -v --release --split-per-abi --dart-define=TMDB_API_KEY=${{ secrets.TMDB_API_KEY }} --dart-define=TMDB_ACCESS_TOKEN=${{ secrets.TMDB_ACCESS_TOKEN }}
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
- name: Set artifact timestamp
run: echo "TIMESTAMP=$(date -u +'%Y%m%dT%H%M%SZ')" >> $GITHUB_ENV
# 发布安装包
- name: Upload Artifact - armeabi-v7a
uses: actions/upload-artifact@v4
with:
path: "build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk"
name: Miru-pr-${{ env.TIMESTAMP }}-armeabi-v7a.apk
- name: Upload Artifact - arm64-v8a
uses: actions/upload-artifact@v4
with:
path: "build/app/outputs/flutter-apk/app-arm64-v8a-release.apk"
name: Miru-pr-${{ env.TIMESTAMP }}-arm64-v8a.apk
- name: Upload Artifact - x86
uses: actions/upload-artifact@v4
with:
path: "build/app/outputs/flutter-apk/app-x86_64-release.apk"
name: Miru-pr-${{ env.TIMESTAMP }}-x86_64.apk
build-and-release-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{env.GO_VERSION}}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: x86_64-pc-windows-msvc
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
- name: Build artifacts
run: flutter build windows -v --release --dart-define=TMDB_API_KEY=${{ secrets.TMDB_API_KEY }} --dart-define=TMDB_ACCESS_TOKEN=${{ secrets.TMDB_ACCESS_TOKEN }}
- name: Rename Release Directory Name to Miru-alpha # 为了解压缩后更好看一点
run: |
mv build/windows/x64/runner/Release build/windows/x64/runner/Miru-alpha
# set a timestamp based on the commit time and use that in artifact names
- name: Set artifact timestamps
run: echo "TIMESTAMP=$(date -u +'%Y%m%dT%H%M%SZ')" >> $GITHUB_ENV
# 发布安装包
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: "build/windows/x64/runner/Miru-alpha"
name: Miru-Alpha-${{ env.TIMESTAMP }}-windows.zip
build-and-release-linux:
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
steps:
- name: Install Dependencies
run: pacman -Sy --noconfirm gtk3 wpewebkit git clang cmake ninja jq alsa-utils alsa-plugins
- name: Config Git to Trust All Repositories
run: |
git config --global --add safe.directory '*'
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{env.GO_VERSION}}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: x86_64-unknown-linux-gnu
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
- name: Build artifacts
run: flutter build linux --release -v --dart-define=TMDB_API_KEY=${{ secrets.TMDB_API_KEY }} --dart-define=TMDB_ACCESS_TOKEN=${{ secrets.TMDB_ACCESS_TOKEN }}
- name: Rename Release Directory Name to Miru-alpha # 为了解压缩后更好看一点
run: |
mv build/linux/x64/release/bundle build/linux/x64/release/Miru-alpha
# set a timestamp based on the commit time and use that in artifact names
- name: Set artifact timestamp
run: echo "TIMESTAMP=$(date -u +'%Y%m%dT%H%M%SZ')" >> $GITHUB_ENV
# 发布安装包
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: "build/linux/x64/release/Miru-alpha"
name: Miru-Alpha-${{ env.TIMESTAMP }}-linux