name: CI on: push: branches: [ master ] jobs: build: strategy: matrix: os: [ubuntu-latest] runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v2 - name: Set Release Version id: get_version shell: bash run: | echo "::set-output name=hash::$(git rev-parse --short HEAD)" echo "::set-output name=url::$(git config --get remote.origin.url)" echo "::set-output name=date::$(date +%Y%m%d)" - name: Setup Java JDK uses: actions/setup-java@v2 with: distribution: 'adopt' java-version: "16" - name: Flutter action uses: subosito/flutter-action@v1.5.3 with: channel: "stable" flutter-version: "3.13.5" - name: Cache Dependencies id: cache uses: actions/cache@v2 with: path: | ~/.gradle/caches ~/.gradle/wrapper Pods ~/local/rubies key: | ${{runner.OS}}-gradle-caches-${{ hashFiles('pubspec.lock') }} ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} restore-keys: | ${{ runner.os }}-pods- ${{ runner.os }}-gradle- - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' run: flutter pub get - name: Build apk if: ${{ runner.os == 'Linux' }} run: flutter build apk --debug --split-per-abi - name: Update to ali oss uses: yizhoumo/setup-ossutil@v1 with: endpoint: oss-cn-qingdao.aliyuncs.com access-key-id: ${{ secrets.OSS_KEY_ID }} access-key-secret: ${{ secrets.OSS_KEY_SECRET }} - name: cp files to aliyun run: | ossutil cp -r --include "*.apk" build/app/outputs/flutter-apk oss://yoqi-software/develop/flutter_cocktail/${{ steps.get_version.outputs.date }}-${{ steps.get_version.outputs.hash }}/ - uses: leafney/dingtalk-action@v1 if: always() env: DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }} with: msgtype: link title: 'build success' text: 'flutter_cocktail has been build success, please download from aliyun oss. [git.yoqi.me]' msg_url: '${{ steps.get_version.outputs.url }}'