Setup CI CD 2 π«ΈπβοΈπ #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build & Release" | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build & Release | |
runs-on: macos-latest | |
steps: | |
#1 Checkout repository | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
#2 setup java | |
- name: Set Up Java | |
uses: actions/setup-java@v3.12.0 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
#3 setup Flutter | |
- name: Set Up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.16.7' | |
channel: 'stable' | |
#4 install dependencies | |
- name: Install Dependencies | |
run: flutter pub get | |
#5 run test | |
#- name: Test flutter app | |
# run: flutter test | |
#6 build apk | |
- name: Build APK | |
run: flutter build apk --release | |
#7 build aab | |
- name: Build appBundle | |
run: flutter build appbundle | |
#8 build ipa | |
- name: Build IPA | |
run: | |
flutter build ipa --no-codesign | |
- name: Compress Archives and IPAs | |
run: | | |
cd build | |
tar -czf ios_build.tar.gz ios | |
#9 get those build to be available to download | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: APK_Releases | |
path: | | |
build/app/outputs/flutter-apk/app-release.apk | |
build/app/outputs/bundle/release/app-release.aab | |
build/ios_build.tar.gz | |
#10 create release with those builds | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "build/app/outputs/flutter-apk/app-release.apk,build/app/outputs/bundle/release/app-release.aab,build/ios_build.tar.gz" | |
tag: v1.0.${{ github.run_number }} | |
token: ${{ secrets.TOKEN }} |