diff --git a/.github/workflows/flibbuild.yml b/.github/workflows/flibbuild.yml new file mode 100644 index 0000000..13e3aa4 --- /dev/null +++ b/.github/workflows/flibbuild.yml @@ -0,0 +1,69 @@ +# 编译apk 同时发布到release页面 + +name: flib build + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + tags: + - '*' + branches: + - main + - master + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + # 这个任务的步骤 + steps: + # 拉取项目代码 + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v2 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + # 建立 java 环境 + - name: 🎉 Setup Java JDK + uses: actions/setup-java@v2 + with: + distribution: 'zulu' # See 'Supported distributions' for available options + java-version: '11' + - run: echo "🖥️ The java setup succeed." + - run: echo "🍏 This job's status is ${{ job.status }}." + # 建立 环境 + - name: 🐧 Flutter action + uses: subosito/flutter-action@v2.3.0 + with: + flutter-version: '2.x' + channel: 'stable' + - run: flutter --version + - name: 💪 build apk + run: | + cd example + flutter pub get + flutter build apk --release + - run: echo "💡 build succeed." + - name: 🚀 upload apk + uses: actions/upload-artifact@v2.3.1 + with: + name: app-preview + path: example/build/app/outputs/apk/release/ + - run: echo "🎉 The job finish upload artifact succeed." + - name: 🖥️ Release apk + uses: ncipollo/release-action@v1.5.0 + if: startsWith(github.ref, 'refs/tags/') + with: + artifacts: "example/build/app/outputs/apk/release/*.apk" + token: ${{ secrets.dev_secret }} + - run: echo "✨ ⭐ 🌟 The job finish release succeed. > ${{startsWith(github.ref, 'refs/tags/')}} 🚀"