|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + tags: |
| 8 | + - 'v*' |
| 9 | + pull_request: |
| 10 | + paths-ignore: |
| 11 | + - '**/*.md' |
| 12 | + - '**/*.txt' |
| 13 | + - '**/*.png' |
| 14 | + - '**/*.jpg' |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + name: Build |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + - uses: actions/setup-java@v2 |
| 23 | + with: |
| 24 | + distribution: 'zulu' |
| 25 | + java-version: 8 |
| 26 | + - uses: subosito/flutter-action@v1 |
| 27 | + with: |
| 28 | + flutter-version: '2.5.3' |
| 29 | + - uses: finnp/create-file-action@master |
| 30 | + env: |
| 31 | + FILE_NAME: lib/common/config/ignoreConfig.dart |
| 32 | + FILE_DATA: class NetConfig { static const CLIENT_ID = "${{ secrets.CLIENT_ID }}"; static const CLIENT_SECRET = "${{ secrets.CLIENT_SECRET }}";} |
| 33 | + - run: flutter pub get |
| 34 | + - run: flutter build apk --release --target-platform=android-arm64 --no-shrink |
| 35 | + |
| 36 | + apk: |
| 37 | + name: Generate APK |
| 38 | + if: startsWith(github.ref, 'refs/tags/v') |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v2 |
| 43 | + - name: Setup JDK |
| 44 | + uses: actions/setup-java@v2 |
| 45 | + with: |
| 46 | + distribution: 'zulu' |
| 47 | + java-version: 8 |
| 48 | + - uses: subosito/flutter-action@v1 |
| 49 | + with: |
| 50 | + flutter-version: '2.5.3' |
| 51 | + - uses: finnp/create-file-action@master |
| 52 | + env: |
| 53 | + FILE_NAME: lib/common/config/ignoreConfig.dart |
| 54 | + FILE_DATA: class NetConfig { static const CLIENT_ID = "${{ secrets.CLIENT_ID }}"; static const CLIENT_SECRET = "${{ secrets.CLIENT_SECRET }}";} |
| 55 | + - run: flutter pub get |
| 56 | + - run: flutter build apk --release --target-platform=android-arm64 --no-shrink |
| 57 | + - name: Upload APK |
| 58 | + uses: actions/upload-artifact@v2 |
| 59 | + with: |
| 60 | + name: apk |
| 61 | + path: build/app/outputs/apk/release/app-release.apk |
| 62 | + release: |
| 63 | + name: Release APK |
| 64 | + needs: apk |
| 65 | + if: startsWith(github.ref, 'refs/tags/v') |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - name: Download APK from build |
| 69 | + uses: actions/download-artifact@v2 |
| 70 | + with: |
| 71 | + name: apk |
| 72 | + - name: Display structure of downloaded files |
| 73 | + run: ls -R |
| 74 | + |
| 75 | + - name: Create Release |
| 76 | + id: create_release |
| 77 | + |
| 78 | + env: |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + with: |
| 81 | + tag_name: ${{ github.ref }} |
| 82 | + release_name: Release ${{ github.ref }} |
| 83 | + - name: Upload Release APK |
| 84 | + id: upload_release_asset |
| 85 | + |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 88 | + with: |
| 89 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 90 | + asset_path: ./app-release.apk |
| 91 | + asset_name: app-release.apk |
| 92 | + asset_content_type: application/zip |
0 commit comments