|
| 1 | +name: Android, iOS, Web Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Android, iOS, Web Build |
| 11 | + |
| 12 | + env: |
| 13 | + my_repo: "sabikrahat/github_workflow_flutter_project.git" |
| 14 | + my_secret: "${{secrets.WORKFLOW_TOKEN}}" |
| 15 | + my_email: "sabikrahat72428@gmail.com" |
| 16 | + my_name: "Md. Sabik Alam Rahat" |
| 17 | + my_tag: "v1.0.${{github.run_number}}" |
| 18 | + |
| 19 | + # This job will run on macos virtual machine |
| 20 | + runs-on: macos-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v3 |
| 25 | + |
| 26 | + - run: | |
| 27 | + echo "Your Repo is $my_repo" |
| 28 | + echo "Your secrect token is $my_secret" |
| 29 | + echo "Your email is $my_email" |
| 30 | + echo "Your name is $my_name" |
| 31 | +
|
| 32 | + # Setup Java environment. |
| 33 | + - name: Setup Java |
| 34 | + uses: actions/setup-java@v3 |
| 35 | + with: |
| 36 | + distribution: "zulu" |
| 37 | + java-version: "18.x" |
| 38 | + |
| 39 | + # Setup the flutter environment. |
| 40 | + - name: Setup Flutter |
| 41 | + uses: subosito/flutter-action@v2 |
| 42 | + with: |
| 43 | + channel: stable |
| 44 | + flutter-version: "3.3.2" |
| 45 | + |
| 46 | + - run: flutter config --enable-android |
| 47 | + - run: flutter config --enable-ios |
| 48 | + - run: flutter config --enable-windows-desktop |
| 49 | + - run: flutter config --enable-web |
| 50 | + - run: flutter clean |
| 51 | + - run: flutter pub get |
| 52 | + |
| 53 | + # # Flutter android apk build command. |
| 54 | + # - run: flutter build apk |
| 55 | + # - run: flutter build apk --split-per-abi |
| 56 | + |
| 57 | + # # Flutter ios ipa build command. |
| 58 | + # - run: | |
| 59 | + # flutter build ios --no-codesign |
| 60 | + # cd build/ios/iphoneos |
| 61 | + # mkdir Payload |
| 62 | + # cd Payload |
| 63 | + # ln -s ../Runner.app |
| 64 | + # cd .. |
| 65 | + # zip -r app.ipa Payload |
| 66 | + |
| 67 | + # Flutter windows build command. |
| 68 | + - run: | |
| 69 | + flutter build windows |
| 70 | + cd build/windows/runner/Release |
| 71 | + mkdir Widnows_Setup |
| 72 | + cd Widnows_Setup |
| 73 | + ln -s ../Release/* |
| 74 | + cd .. |
| 75 | + zip -r widnows_setup.zip Widnows_Setup |
| 76 | +
|
| 77 | + # # Flutter web release command. |
| 78 | + # - run: flutter build web --web-renderer html --release |
| 79 | + # - run: | |
| 80 | + # cd build/web |
| 81 | + # git init |
| 82 | + # git config --global user.email "$my_email" |
| 83 | + # git config --global user.name "$my_name" |
| 84 | + # git status |
| 85 | + # git remote add origin https://"$my_secret"@github.com/"$my_repo" |
| 86 | + # git checkout -b gh-pages |
| 87 | + # git add --all |
| 88 | + # git commit -m "update" |
| 89 | + # git push origin gh-pages -f |
| 90 | + |
| 91 | + # Upload assets to release |
| 92 | + - name: Push to Release |
| 93 | + uses: ncipollo/release-action@v1 |
| 94 | + with: |
| 95 | + artifacts: "build/windows/runner/widnows_setup.zip" |
| 96 | + # artifacts: "build/app/outputs/flutter-apk/*,build/ios/iphoneos/app.ipa" |
| 97 | + tag: ${{env.my_tag}} |
| 98 | + token: ${{env.my_secret}} |
0 commit comments