Skip to content

Commit

Permalink
Merge branch 'main' of github.com:guozhigq/flutter_v2ex
Browse files Browse the repository at this point in the history
  • Loading branch information
guozhigq committed Mar 12, 2023
2 parents 124cda6 + 766121e commit c0df905
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: build_apk

# action事件触发
on:
# push main时触发
push:
# branches: [main]
# push tag时触发
tags:
- v*
# push_request:
# branches: [main]

# 可以有多个jobs
jobs:
build_apk:
# 运行环境 ubuntu-latest window-latest mac-latest
runs-on: ubuntu-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:
version: 3.7.7
channel: stable

# 签名文件
# - name: Decode keystore
# run: |
# echo $KEYSTORE_BASE64 | base64 -di > android/app/vvex.jks
# env:
# KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}

# 下载项目依赖
- name: flutter pub get
run: flutter pub get

- name: 解码生成 jks
run: echo $KEYSTORE_BASE64 | base64 -di > android/app/vvex.jks
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}

- name: flutter build apk
# 对应 android/app/build.gradle signingConfigs中的配置项
run: flutter build apk --release --split-per-abi
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}

- name: 发布
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/app-*.apk"
token: ${{ secrets.GIT_TOKEN }}
allowUpdates: true

0 comments on commit c0df905

Please sign in to comment.