Skip to content

Android

yaml
name: Android CI

on:
  push:
    tags:
      - v*
  pull_request:
    tags:
      - v*

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-java@v2
      with:
        distribution: 'zulu' # See 'Supported distributions' for available options
        java-version: '11'
    
    - name: Checkout Android Keystore
      uses: actions/checkout@v2
      with:
        repository: Potato-DiGua/android-key-store
        token: ${{ secrets.TOKEN }}
        path: keystore
    
    - name: Build with Gradle
      run: bash ./gradlew assembleRelease

    - name: Release
      uses: softprops/action-gh-release@v1
      if: startsWith(github.ref, 'refs/tags/')
      with:
        files: |
          app/build/outputs/apk/release/*.apk

Flutter

yaml
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  release:
    types: [released]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

env:
  # APP名称
  APP_NAME: FlutterDevToys

# 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-macOS:
    # The type of runner that the job will run on
    runs-on: macos-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
      - uses: subosito/flutter-action@v2
        with:
          channel: 'stable'
          
      - name: Build
        run: |
          flutter config --enable-macos-desktop
          flutter build macos
          ditto -c -k --sequesterRsrc --keepParent ./build/macos/Build/Products/Release/*.app ${{ env.APP_NAME }}-macOS.zip
      
      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: |
            ${{ env.APP_NAME }}-macOS.zip
            
  build-windows:
    # The type of runner that the job will run on
    runs-on: windows-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2
      - uses: subosito/flutter-action@v2
        with:
          channel: 'stable'
          
      - name: Build
        run: |
          flutter config --enable-windows-desktop
          flutter build windows
          Compress-Archive -Path .\build\windows\runner\Release\* -DestinationPath ${{ env.APP_NAME }}-windows.zip
      
      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: |
            ${{ env.APP_NAME }}-windows.zip