Skip to content

add Windows ci (#26) #6

add Windows ci (#26)

add Windows ci (#26) #6

Workflow file for this run

name: build_windows
# action事件触发
on:
push:
branches:
- "*"
# push tag时触发
tags:
- "*"
pull_request:
workflow_dispatch:
# 可以有多个jobs
jobs:
build_windows:
# 运行环境 ubuntu-latest windows-latest mac-latest
runs-on: windows-latest
# 每个jobs中可以有多个steps
steps:
- name: 代码迁出
uses: actions/checkout@v3
- name: 构建Java环境
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"
token: ${{secrets.GIT_TOKEN}}
# - name: 检查缓存
# uses: actions/cache@v2
# id: cache-flutter
# with:
# path: /root/flutter-sdk # Flutter SDK 的路径
# key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
- name: 安装Flutter
# if: steps.cache-flutter.outputs.cache-hit != 'true'
uses: subosito/flutter-action@v2
with:
flutter-version: 3.16.5
channel: any
- name: 启用windows支持
run: |
flutter config --enable-windows-desktop
- name: 下载项目依赖
run: flutter pub get
- name: flutter build windows
# 对应 android/app/build.gradle signingConfigs中的配置项
run: flutter build windows
- name: 获取版本号
id: version
run: echo "version=${GITHUB_REF#refs/tags/v}" >>$GITHUB_OUTPUT
# - name: 获取当前日期
# id: date
# run: echo "date=$(date +'%m%d')" >>$GITHUB_OUTPUT
- name: 重命名应用 Pili-windows-x64.zip
run: |
7z a -tzip Pili-windows-x64.zip -r build/windows/x64/runner/Release/*
shell: bash
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Pili-Windows-x64
path: Pili-windows-x64.zip