Skip to content

Commit e6110b1

Browse files
authored
Create flibbuild.yml
1 parent fb1875a commit e6110b1

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/flibbuild.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 编译apk 同时发布到release页面
2+
3+
name: flib build
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the master branch
8+
push:
9+
tags:
10+
- '*'
11+
branches:
12+
- main
13+
- master
14+
15+
# Allows you to run this workflow manually from the Actions tab
16+
workflow_dispatch:
17+
18+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
19+
jobs:
20+
# This workflow contains a single job called "build"
21+
build:
22+
# The type of runner that the job will run on
23+
runs-on: ubuntu-latest
24+
25+
# Steps represent a sequence of tasks that will be executed as part of the job
26+
# 这个任务的步骤
27+
steps:
28+
# 拉取项目代码
29+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
30+
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
31+
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
32+
- name: Check out repository code
33+
uses: actions/checkout@v2
34+
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
35+
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
36+
# 建立 java 环境
37+
- name: 🎉 Setup Java JDK
38+
uses: actions/setup-java@v2
39+
with:
40+
distribution: 'zulu' # See 'Supported distributions' for available options
41+
java-version: '11'
42+
- run: echo "🖥️ The java setup succeed."
43+
- run: echo "🍏 This job's status is ${{ job.status }}."
44+
# 建立 环境
45+
- name: 🐧 Flutter action
46+
uses: subosito/[email protected]
47+
with:
48+
flutter-version: '2.x'
49+
channel: 'stable'
50+
- run: flutter --version
51+
- name: 💪 build apk
52+
run: |
53+
cd example
54+
flutter pub get
55+
flutter build apk --release
56+
- run: echo "💡 build succeed."
57+
- name: 🚀 upload apk
58+
uses: actions/[email protected]
59+
with:
60+
name: app-preview
61+
path: example/build/app/outputs/apk/release/
62+
- run: echo "🎉 The job finish upload artifact succeed."
63+
- name: 🖥️ Release apk
64+
uses: ncipollo/[email protected]
65+
if: startsWith(github.ref, 'refs/tags/')
66+
with:
67+
artifacts: "example/build/app/outputs/apk/release/*.apk"
68+
token: ${{ secrets.dev_secret }}
69+
- run: echo "✨ ⭐ 🌟 The job finish release succeed. > ${{startsWith(github.ref, 'refs/tags/')}} 🚀"

0 commit comments

Comments
 (0)