Skip to content

Commit

Permalink
Merge pull request #871 from frg2089/master
Browse files Browse the repository at this point in the history
添加 Windows CI
  • Loading branch information
Notsfsssf authored Dec 25, 2024
2 parents d47bed1 + 5dabc10 commit 2bccf68
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 35 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Build Windows

on:
push:
workflow_dispatch:

jobs:
build:
name: Build Windows
runs-on: windows-latest
steps:
- name: 签出仓库
uses: actions/checkout@v4

- name: 初始化 Flutter 环境
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
architecture: x64

- name: 初始化 Rust 工具链
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1

- name: 还原依赖
run: flutter pub get

- name: 生成代码
run: dart run build_runner build --delete-conflicting-outputs

- name: 构建项目
run: flutter build windows

- name: 上传产物
id: binary-artifact
uses: actions/upload-artifact@v4
with:
name: binary
path: build/windows/x64/runner/Release/**/*
compression-level: 9

- name: 还原证书
shell: pwsh
if: env.CERTIFICATE != ''
env:
CERTIFICATE: ${{ secrets.CERTIFICATE }}
run: |-
$base64File = New-TemporaryFile
$certFile = (New-TemporaryFile).FullName + '.pfx'
Out-File -InputObject $env:CERTIFICATE -LiteralPath $base64File
openssl enc -base64 -d -in $base64File.FullName -out $certFile
Write-Output "CERTIFICATE_PATH=$certFile" >> "$env:GITHUB_ENV"
- name: 构建 MSIX
id: msix
shell: pwsh
if: env.CERTIFICATE_PATH != ''
env:
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
run: |-
dart run msix:create `
--certificate-path $env:CERTIFICATE_PATH `
--certificate-password $env:CERTIFICATE_PASSWORD `
--build-windows false `
--publisher (Get-PfxCertificate $env:CERTIFICATE_PATH -Password ($env:CERTIFICATE_PASSWORD | ConvertTo-SecureString -AsPlainText)).Subject
- name: 上传 MSIX
id: msix-artifact
if: steps.msix.conclusion == 'success'
uses: actions/upload-artifact@v4
with:
name: msix
path: build/windows/x64/runner/Release/pixez.msix
compression-level: 9

- name: 生成 MSIX 安装器
id: installer
if: steps.msix.conclusion == 'success'
uses: frg2089/MsixInstaller@v1
with:
msix: build/windows/x64/runner/Release/pixez.msix

- name: 上传 MSIX 安装器
id: installer-artifact
if: steps.installer.conclusion == 'success'
uses: actions/upload-artifact@v4
with:
name: installer
path: ${{ steps.installer.outputs.path }}
compression-level: 9

- name: 生成校验和
shell: pwsh
run: |-
Write-Output '### Build Success :rocket:' >> $env:GITHUB_STEP_SUMMARY
Write-Output '|File|SHA256|' >> $env:GITHUB_STEP_SUMMARY
Write-Output '|:-|:-:|' >> $env:GITHUB_STEP_SUMMARY
Write-Output "|[binary](${{ steps.binary-artifact.outputs.artifact-url }})|${{ steps.binary-artifact.outputs.artifact-digest }}|" >> $env:GITHUB_STEP_SUMMARY
if ('${{ steps.msix-artifact.conclusion }}' -eq 'success') {
Write-Output "|[msix](${{ steps.msix-artifact.outputs.artifact-url }})|${{ steps.msix-artifact.outputs.artifact-digest }}|" >> $env:GITHUB_STEP_SUMMARY
}
if ('${{ steps.installer-artifact.conclusion }}' -eq 'success') {
Write-Output "|[installer](${{ steps.installer-artifact.outputs.artifact-url }})|${{ steps.installer-artifact.outputs.artifact-digest }}|" >> $env:GITHUB_STEP_SUMMARY
}
Write-Output '' >> $env:GITHUB_STEP_SUMMARY
Write-Output '### MSIX 安装教程' >> $env:GITHUB_STEP_SUMMARY
Write-Output '![image](https://github.com/Notsfsssf/pixez-flutter/assets/42184238/f1956682-f527-487d-997b-523319cd78d3)' >> $env:GITHUB_STEP_SUMMARY
25 changes: 17 additions & 8 deletions .metadata
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
# This file should be version controlled and should not be manually edited.

version:
revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a
channel: dev
revision: "17025dd88227cd9532c33fa78f5250d548d87e9a"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a
base_revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a
- platform: ohos
create_revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a
base_revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
- platform: android
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
- platform: ios
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
- platform: macos
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
- platform: windows
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a

# User provided section

Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/component/pixez_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PixEzButton extends StatelessWidget {
child: ButtonTheme(
data: ButtonThemeData(
iconButtonStyle: ButtonStyle(
padding: ButtonState.all(EdgeInsets.zero),
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
),
child: IconButton(
Expand Down
1 change: 0 additions & 1 deletion lib/fluent/component/search_box/pixez_search_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ class _PixEzSearchBoxState extends State<StatefulWidget> {
);
},
);
default:
}
}
}
2 changes: 1 addition & 1 deletion lib/fluent/component/selectable_html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class _SelectableHtmlState extends State<SelectableHtml> {
if (e.attributes.containsKey('href')) {
final color = FluentTheme.of(context).accentColor;
return {
'color': '#${color.value.toRadixString(16).substring(2, 8)}'
'color': '#${color.colorValue.toRadixString(16).substring(2, 8)}'
};
}
return null;
Expand Down
8 changes: 4 additions & 4 deletions lib/fluent/page/hello/recom/recom_spotlight_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ class _RecomSpolightPageState extends State<RecomSpolightPage>
child: ButtonTheme(
data: ButtonThemeData(
iconButtonStyle: ButtonStyle(
padding: ButtonState.all(EdgeInsets.zero),
padding: WidgetStateProperty.all(EdgeInsets.zero),
backgroundColor:
ButtonState.all(Colors.transparent),
WidgetStateProperty.all(Colors.transparent),
),
),
child: PixEzButton(
Expand Down Expand Up @@ -320,8 +320,8 @@ class _RecomSpolightPageState extends State<RecomSpolightPage>
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black.withOpacity(0.0),
Colors.black.withOpacity(opacity),
Colors.black.withValues(alpha: 255 * 0.0),
Colors.black.withValues(alpha: 255 * opacity),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/page/hello/recom/recom_user_road.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class _RecomUserRoadState extends State<RecomUserRoad> {
child: ButtonTheme(
data: ButtonThemeData(
iconButtonStyle: ButtonStyle(
padding: ButtonState.all(EdgeInsets.zero),
padding: WidgetStateProperty.all(EdgeInsets.zero),
),
),
child: IconButton(
Expand Down
5 changes: 1 addition & 4 deletions lib/fluent/page/network/network_setting_page.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import 'dart:io';

import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:path_provider/path_provider.dart';
import 'package:pixez/fluent/component/pixiv_image.dart';
import 'package:pixez/er/hoster.dart';
import 'package:pixez/fluent/component/pixiv_image.dart';
import 'package:pixez/i18n.dart';
import 'package:pixez/main.dart';
import 'package:pixez/network/api_client.dart';
Expand Down
6 changes: 3 additions & 3 deletions lib/fluent/page/picture/illust_items_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ abstract class IllustItemsPageState extends State<IllustItemsPage>
),
data: ButtonThemeData(
iconButtonStyle: ButtonStyle(
backgroundColor: ButtonState.all(
backgroundColor: WidgetStateProperty.all(
FluentTheme.of(context).inactiveBackgroundColor,
),
shadowColor: ButtonState.all(
shadowColor: WidgetStateProperty.all(
FluentTheme.of(context).shadowColor,
),
shape: ButtonState.all(CircleBorder()),
shape: WidgetStateProperty.all(CircleBorder()),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/page/report/report_items_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class _ReportItemsPageState extends State<ReportItemsPage> {
final title = items[index];
return Container(
color: index == _selectItem
? FluentTheme.of(context).accentColor.withOpacity(0.5)
? FluentTheme.of(context).accentColor.withValues(alpha: 255 * 0.5)
: Colors.transparent,
child: ListTile(
title: Text(title),
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/page/theme/theme_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class _ColorPickPageState extends State<ColorPickPage> {
onPressed: () async {
final TextEditingController textEditingController =
TextEditingController(
text: pickerColor.value
text: pickerColor.colorValue
.toString()
.toLowerCase()
.replaceAll('color(0xff', '')
Expand Down
17 changes: 7 additions & 10 deletions lib/fluent/page/user/users_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,27 @@ import 'dart:io';
import 'package:bot_toast/bot_toast.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:fluent_ui/fluent_ui.dart' hide NestedScrollView;
import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:path_provider/path_provider.dart';
import 'package:pixez/fluent/component/context_menu.dart';
import 'package:pixez/fluent/component/painter_avatar.dart';
import 'package:pixez/fluent/component/pixiv_image.dart';
import 'package:pixez/component/null_hero.dart';
import 'package:pixez/document_plugin.dart';
import 'package:pixez/er/hoster.dart';
import 'package:pixez/er/leader.dart';
import 'package:pixez/exts.dart';
import 'package:pixez/i18n.dart';
import 'package:pixez/main.dart';
import 'package:pixez/models/illust.dart';
import 'package:pixez/fluent/component/context_menu.dart';
import 'package:pixez/fluent/component/painter_avatar.dart';
import 'package:pixez/fluent/component/pixiv_image.dart';
import 'package:pixez/fluent/page/follow/follow_list.dart';
import 'package:pixez/fluent/page/report/report_items_page.dart';
import 'package:pixez/fluent/page/shield/shield_page.dart';
import 'package:pixez/fluent/page/user/bookmark/bookmark_page.dart';
import 'package:pixez/fluent/page/user/detail/user_detail.dart';
import 'package:pixez/fluent/page/user/works/works_page.dart';
import 'package:pixez/fluent/page/zoom/zoom_page.dart';
import 'package:pixez/i18n.dart';
import 'package:pixez/main.dart';
import 'package:pixez/models/illust.dart';
import 'package:pixez/network/api_client.dart';
import 'package:pixez/page/user/user_store.dart';
import 'package:share_plus/share_plus.dart';
Expand Down Expand Up @@ -420,7 +417,7 @@ class _UsersPageState extends State<UsersPage>
child: Container(
color: FluentTheme.of(context)
.acrylicBackgroundColor
.withOpacity(.5),
.withValues(alpha: 255 * .5),
),
),
),
Expand Down

0 comments on commit 2bccf68

Please sign in to comment.