mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
fix: 安卓端编译多个包时,buildNumber会额外拼上1、2、3之类的,会对更新判断造成影响
This commit is contained in:
7
.github/workflows/CI.yml
vendored
7
.github/workflows/CI.yml
vendored
@@ -86,10 +86,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# 更新pubspec.yaml文件中的版本号
|
# 更新pubspec.yaml文件中的版本号
|
||||||
sed -i "s/version: .*/version: ${{ needs.update_version.outputs.new_version }}/g" pubspec.yaml
|
sed -i "s/version: .*/version: ${{ needs.update_version.outputs.new_version }}/g" pubspec.yaml
|
||||||
yq e .version pubspec.yaml
|
|
||||||
|
|
||||||
- name: flutter build apk
|
- name: flutter build apk
|
||||||
run: flutter build apk --release --split-per-abi --build-number ${{ github.run_number }}
|
run: flutter build apk --release --split-per-abi
|
||||||
env:
|
env:
|
||||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||||
@@ -172,10 +171,10 @@ jobs:
|
|||||||
- name: Upload Pre-release
|
- name: Upload Pre-release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
name: v${{ needs.update_version.outputs.new_version }}
|
name: ${{ needs.update_version.outputs.new_version }}
|
||||||
token: ${{ secrets.GIT_TOKEN }}
|
token: ${{ secrets.GIT_TOKEN }}
|
||||||
commit: main
|
commit: main
|
||||||
tag: v${{ needs.update_version.outputs.new_version }}
|
tag: ${{ needs.update_version.outputs.new_version }}
|
||||||
prerelease: true
|
prerelease: true
|
||||||
allowUpdates: true
|
allowUpdates: true
|
||||||
artifacts: Pilipala-CI/*
|
artifacts: Pilipala-CI/*
|
||||||
|
|||||||
1
.github/workflows/main.yml
vendored
1
.github/workflows/main.yml
vendored
@@ -6,7 +6,6 @@ on:
|
|||||||
# push tag时触发
|
# push tag时触发
|
||||||
tags:
|
tags:
|
||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
- "!v*.*.*\+*"
|
|
||||||
|
|
||||||
# 可以有多个jobs
|
# 可以有多个jobs
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
@@ -194,7 +196,12 @@ class AboutController extends GetxController {
|
|||||||
// 获取当前版本
|
// 获取当前版本
|
||||||
Future getCurrentApp() async {
|
Future getCurrentApp() async {
|
||||||
var currentInfo = await PackageInfo.fromPlatform();
|
var currentInfo = await PackageInfo.fromPlatform();
|
||||||
currentVersion.value = "v${currentInfo.version}+${currentInfo.buildNumber}";
|
String buildNumber = currentInfo.buildNumber;
|
||||||
|
//if is android
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
buildNumber = buildNumber.substring(0,buildNumber.length - 1);
|
||||||
|
}
|
||||||
|
currentVersion.value = "v${currentInfo.version}+$buildNumber";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取远程版本
|
// 获取远程版本
|
||||||
|
|||||||
@@ -225,7 +225,11 @@ class Utils {
|
|||||||
var currentInfo = await PackageInfo.fromPlatform();
|
var currentInfo = await PackageInfo.fromPlatform();
|
||||||
var result = await Request().get(Api.latestApp, extra: {'ua': 'mob'});
|
var result = await Request().get(Api.latestApp, extra: {'ua': 'mob'});
|
||||||
LatestDataModel data = LatestDataModel.fromJson(result.data[0]);
|
LatestDataModel data = LatestDataModel.fromJson(result.data[0]);
|
||||||
bool isUpdate = Utils.needUpdate("v${currentInfo.version}+${currentInfo.buildNumber}", data.tagName!);
|
String buildNumber = currentInfo.buildNumber;
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
buildNumber = buildNumber.substring(0, buildNumber.length - 1);
|
||||||
|
}
|
||||||
|
bool isUpdate = Utils.needUpdate("v${currentInfo.version}+$buildNumber", data.tagName!);
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
SmartDialog.show(
|
SmartDialog.show(
|
||||||
animationType: SmartAnimationType.centerFade_otherSlide,
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
|
|||||||
Reference in New Issue
Block a user