diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 74130e6..4e0f127 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -19,10 +19,22 @@ jobs: path: | ~/.gradle/caches ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + key: ${{ runner.os }}-gradle-${{ hashFiles('app/**/*.gradle*', 'app/**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- + - name: Cache Android SDK + uses: actions/cache@v3 + with: + path: | + /usr/local/lib/android/sdk/platform-tools + /usr/local/lib/android/sdk/platforms + /usr/local/lib/android/sdk/build-tools + /usr/local/lib/android/sdk/licenses + key: ${{ runner.os }}-android-sdk-${{ hashFiles('app/android/build.gradle') }} + restore-keys: | + ${{ runner.os }}-android-sdk- + - name: Set up Flutter uses: subosito/flutter-action@v2 with: @@ -35,8 +47,8 @@ jobs: with: path: | ${{ env.PUB_CACHE }} - .dart_tool - key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + app/.dart_tool + key: ${{ runner.os }}-pub-${{ hashFiles('app/**/pubspec.lock') }} restore-keys: | ${{ runner.os }}-pub- @@ -59,11 +71,12 @@ jobs: run: | cd app dart ./scripts/keys-n-stuff.dart - + - name: Install pub dependencies + run: cd app && flutter pub get + - name: Sync android version + run: cd app && dart scripts/version_sync.dart - run: | cd app - flutter pub get - dart scripts/version_sync.dart flutter build apk -t lib/main.firebase.dart --release flutter build appbundle -t lib/main.firebase.dart --release diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..3f9571c --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,43 @@ +on: + push: + tags: + - "*" + +name: Linux build and release +jobs: + linux: + name: Linux + runs-on: ubuntu-latest + steps: + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: "3.24.5" + channel: "stable" + + - uses: actions/checkout@v4 + with: + path: "app" + + - name: Install required build tools for linux + run: | + sudo apt-get update -y + sudo apt-get upgrade -y + sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa + sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev + + - run: | + cd app + flutter config --enable-linux-desktop + flutter pub get + flutter build linux --release + cd build/linux/x64/release + zip -r linux-release.zip bundle + + - name: Create linux Release + uses: ncipollo/release-action@v1 + with: + artifacts: "app/build/linux/x64/release/linux-release.zip" + token: ${{ secrets.TOKEN }} + allowUpdates: true diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000..a262df5 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,47 @@ +on: + push: + tags: + - "*" + +name: MacOS build and release +jobs: + macos: + name: MacOS + runs-on: macos-latest + steps: + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: "3.22.2" + channel: "stable" + + - uses: actions/checkout@v4 + with: + path: "app" + + - uses: actions/checkout@v4 + with: + repository: "hmziqrs/keys-n-stuff" + path: "app/.keys-n-stuff" + token: ${{ secrets.TOKEN }} + + - name: Execute Keys n Stuff + run: | + cd app + dart ./scripts/keys-n-stuff.dart + + - run: | + cd app + flutter config --enable-macos-desktop + flutter pub global activate flutterfire_cli + flutter pub get + flutter build macos -t lib/main.firebase.dart --release + cd build/macos/Build/Products/Release + ditto -c -k --sequesterRsrc --keepParent flutter_uis.app macos-release.zip + + - uses: ncipollo/release-action@v1 + with: + artifacts: "app/build/macOS/Build/Products/Release/macos-release.zip" + token: ${{ secrets.TOKEN }} + allowUpdates: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 9ef0854..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,260 +0,0 @@ -on: - push: - tags: - - "*" - -name: Release Builds -jobs: - linux: - name: Linux - runs-on: ubuntu-latest - steps: - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.24.5" - channel: "stable" - - - uses: actions/checkout@v4 - with: - path: "app" - - - name: Install required build tools for linux - run: | - sudo apt-get update -y - sudo apt-get upgrade -y - sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa - sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev - - - run: | - cd app - flutter config --enable-linux-desktop - flutter pub get - flutter build linux --release - cd build/linux/x64/release - zip -r linux-release.zip bundle - - - name: Create linux Release - uses: ncipollo/release-action@v1 - with: - artifacts: "app/build/linux/x64/release/linux-release.zip" - token: ${{ secrets.TOKEN }} - allowUpdates: true - - web: - name: Web - runs-on: ubuntu-latest - permissions: - contents: read - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.24.5" - channel: "stable" - - - uses: actions/checkout@v4 - with: - path: "app" - - uses: oven-sh/setup-bun@v2 - - name: Setup Pages - uses: actions/configure-pages@v5 - - - name: Build web release - run: | - cd app - flutter config --enable-web - flutter pub get - flutter build web -t lib/main.web.dart --release --no-tree-shake-icons --wasm - - - name: Deploy cloudflare pages - uses: cloudflare/wrangler-action@v3 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - packageManager: "bun" - command: pages deploy ./app/build/web --project-name=flutter-uis --branch=main - - # Deploy to Firebase - - name: Deploy to Firebase - uses: w9jds/firebase-action@master - with: - args: deploy --only hosting - env: - PROJECT_PATH: "app" - GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} - - # GitHub Pages deployment steps - - name: Upload artifact for GitHub Pages - uses: actions/upload-pages-artifact@v3 - with: - path: app/build/web - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 - - # android: - # name: Android - # runs-on: ubuntu-latest - # permissions: - # contents: read - # pages: write - # id-token: write - # steps: - # - name: Set up Flutter - # uses: subosito/flutter-action@v2 - # with: - # flutter-version: "3.22.2" - # channel: "stable" - - # - uses: actions/setup-java@v4 - # with: - # java-version: "17" - # distribution: "oracle" - - # - uses: actions/checkout@v4 - # with: - # path: "app" - - # - uses: actions/checkout@v4 - # with: - # repository: "hmziqrs/keys-n-stuff" - # path: "app/.keys-n-stuff" - # token: ${{ secrets.TOKEN }} - - # - name: Execute Keys n Stuff - # run: | - # cd app - # dart ./scripts/keys-n-stuff.dart - - # - run: | - # cd app - # flutter pub get - # dart scripts/version_sync.dart - # flutter build apk -t lib/main.firebase.dart --release - # flutter build appbundle -t lib/main.firebase.dart --release - - # - name: Create Android Release - # uses: ncipollo/release-action@v1 - # with: - # artifacts: "app/build/app/outputs/apk/release/app-release.apk,app/build/app/outputs/bundle/release/app-release.aab" - # token: ${{ secrets.TOKEN }} - # allowUpdates: true - - # - uses: actions/upload-artifact@v4 - # with: - # name: "app-release.aab" - # path: "app/build/app/outputs/bundle/release/app-release.aab" - # - uses: actions/upload-artifact@v4 - # with: - # name: "app-release.apk" - # path: "app/build/app/outputs/apk/release/app-release.apk" - - # playstore: - # name: Playstore Release - # needs: android - # runs-on: ubuntu-latest - # permissions: - # contents: read - # pages: write - # id-token: write - # steps: - # - uses: actions/checkout@v4 - # with: - # repository: "hmziqrs/keys-n-stuff" - # path: "keys" - # token: ${{ secrets.TOKEN }} - - # - uses: actions/download-artifact@v4 - # with: - # name: app-release.aab - # path: artifacts - # - run: ls -lah - # - run: ls -lah keys/ - # - run: ls -lah keys/fuid - # - run: ls -lah artifacts - # - run: ls -lah artifacts/app-release.aab - # - name: Upload app bundle to Google Play - # uses: r0adkll/upload-google-play@v1 - # with: - # serviceAccountJson: "keys/fuid/service-account.json" - # packageName: "com.onemdev.flutter_ui_challenges" - # releaseFile: "artifacts/*.aab" - # track: "beta" - # inAppUpdatePriority: 3 - # status: completed - - macos: - name: MacOS - runs-on: macos-latest - steps: - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.22.2" - channel: "stable" - - - uses: actions/checkout@v4 - with: - path: "app" - - - uses: actions/checkout@v4 - with: - repository: "hmziqrs/keys-n-stuff" - path: "app/.keys-n-stuff" - token: ${{ secrets.TOKEN }} - - - name: Execute Keys n Stuff - run: | - cd app - dart ./scripts/keys-n-stuff.dart - - - run: | - cd app - flutter config --enable-macos-desktop - flutter pub global activate flutterfire_cli - flutter pub get - flutter build macos -t lib/main.firebase.dart --release - cd build/macos/Build/Products/Release - ditto -c -k --sequesterRsrc --keepParent flutter_uis.app macos-release.zip - - - uses: ncipollo/release-action@v1 - with: - artifacts: "app/build/macOS/Build/Products/Release/macos-release.zip" - token: ${{ secrets.TOKEN }} - allowUpdates: true - - windows: - name: Windows - runs-on: windows-latest - steps: - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.24.5" - channel: "stable" - - - uses: actions/checkout@v4 - with: - path: "app" - - - run: | - cd app - flutter config --enable-windows-desktop - flutter pub get - flutter build windows --release - cd build\windows\x64\runner - Compress-Archive -Path Release -DestinationPath windows-release.zip - - - name: Windows release build for github - uses: ncipollo/release-action@v1 - with: - artifacts: 'app\build\windows\x64\runner\windows-release.zip' - token: ${{ secrets.TOKEN }} - allowUpdates: true diff --git a/.github/workflows/main.yml.backup b/.github/workflows/main.yml.backup deleted file mode 100644 index 1bb6ceb..0000000 --- a/.github/workflows/main.yml.backup +++ /dev/null @@ -1,141 +0,0 @@ -# on: -# push: -# tags: -# - '*' - -name: Release Builds -jobs: - linux: - name: Linux - runs-on: ubuntu-latest - steps: - - run: | - git clone https://github.com/flutter/flutter.git - cd flutter - git checkout 72aa23eb93 - - run: echo `pwd`"/flutter/bin" >> $GITHUB_PATH - # - run: flutter doctor - - uses: actions/checkout@v2 - with: - path: 'app' - - name: Install required build tools for linux - run: sudo apt-get update && sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev - - run: | - cd app - flutter config --enable-linux-desktop - flutter pub get - flutter build linux --release - cd build/linux/release - zip -r linux-release.zip bundle - - name: Create linux Release - uses: ncipollo/release-action@v1 - with: - artifacts: 'app/build/linux/release/linux-release.zip' - token: ${{ secrets.TOKEN }} - allowUpdates: true - - web: - name: Web - runs-on: ubuntu-latest - steps: - - run: | - git clone https://github.com/flutter/flutter.git - cd flutter - git checkout 72aa23eb93 - - run: echo `pwd`"/flutter/bin" >> $GITHUB_PATH - - uses: actions/checkout@v2 - with: - path: 'app' - - - run: | - cd app - flutter config --enable-web - flutter pub get - flutter build web -t lib/main.firebase.dart --release - - name: Deploy to Firebase - uses: w9jds/firebase-action@v1.3.0 - with: - args: deploy --only hosting - env: - PROJECT_PATH: 'app' - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - - android: - name: Android - runs-on: ubuntu-latest - steps: - - run: | - git clone https://github.com/flutter/flutter.git - cd flutter - git checkout 72aa23eb93 - - run: echo `pwd`"/flutter/bin" >> $GITHUB_PATH - - uses: actions/setup-java@v1 - with: - java-version: '12.x' - - name: Install NDK - run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT} - - uses: actions/checkout@v2 - with: - path: 'app' - - run: | - cd app - flutter pub get - flutter build apk -t lib/main.firebase.dart --release - - name: Create Android Release - uses: ncipollo/release-action@v1 - with: - artifacts: 'app/build/app/outputs/apk/release/app-release.apk' - token: ${{ secrets.TOKEN }} - allowUpdates: true - - macos: - name: MacOS - runs-on: macos-latest - steps: - - run: | - git clone https://github.com/flutter/flutter.git - cd flutter - git checkout 72aa23eb93 - - run: echo `pwd`"/flutter/bin" >> $GITHUB_PATH - - uses: actions/checkout@v2 - with: - path: 'app' - - run: | - cd app - flutter config --enable-macos-desktop - flutter pub get - flutter build macos -t lib/main.firebase.dart --release - cd build/macos/Build/Products/Release - ditto -c -k --sequesterRsrc --keepParent flutter_uis.app macos-release.zip - - uses: ncipollo/release-action@v1 - with: - artifacts: 'app/build/macOS/Build/Products/Release/macos-release.zip' - token: ${{ secrets.TOKEN }} - allowUpdates: true - - windows: - name: Windows - runs-on: windows-latest - steps: - - run: | - git clone https://github.com/flutter/flutter.git - cd flutter - git checkout 72aa23eb93 - # - run: echo >> $GITHUB_PATH - - run: echo "$(pwd)\flutter\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - uses: actions/checkout@v2 - with: - path: 'app' - - run: | - cd app - flutter config --enable-windows-desktop - flutter pub get - flutter build windows --release - cd build\windows\runner - Compress-Archive -Path Release -DestinationPath windows-release.zip - - name: Windows release build for github - uses: ncipollo/release-action@v1 - with: - artifacts: 'app\build\windows\runner\windows-release.zip' - token: ${{ secrets.TOKEN }} - allowUpdates: true diff --git a/.github/workflows/main.yml.old b/.github/workflows/main.yml.old deleted file mode 100644 index f77e5e8..0000000 --- a/.github/workflows/main.yml.old +++ /dev/null @@ -1,136 +0,0 @@ -on: - push: - tags: - - '*' - -name: Release Builds -jobs: - linux: - name: Android & Linux & Web - runs-on: ubuntu-latest - steps: - - run: | - git clone https://github.com/flutter/flutter.git - cd flutter - git checkout 4df8fdb7df - - run: echo ::add-path::`pwd`"/flutter/bin" - - - uses: actions/setup-java@v1 - with: - java-version: '12.x' - - - uses: actions/setup-node@v1 - with: - node-version: '12.13.1' - - - uses: actions/checkout@v2 - with: - path: 'app' - - - run: | - cd app - flutter config --enable-linux-desktop - flutter config --enable-web - flutter pub get - flutter build linux --release - flutter build apk --release - flutter build web --release - cd build/linux/ - zip -r linux-release.zip release - - - run: | - cd app - npm i - npm run upload apk ${{ secrets.ACCOUNT }} - npm run upload linux ${{ secrets.ACCOUNT }} - - - name: Deploy to Firebase - uses: w9jds/firebase-action@v1.3.0 - with: - args: deploy --only hosting - env: - PROJECT_PATH: 'app' - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - - - name: Create Android & linux Release - uses: ncipollo/release-action@v1 - with: - artifacts: 'app/build/app/outputs/apk/release/app-release.apk,app/build/linux/linux-release.zip' - token: ${{ secrets.TOKEN }} - allowUpdates: true - - macos: - name: MacOS - runs-on: macos-latest - steps: - - run: | - git clone https://github.com/flutter/flutter.git - cd flutter - git checkout 4df8fdb7df - - run: echo ::add-path::`pwd`"/flutter/bin" - - - uses: actions/setup-node@v1 - with: - node-version: '12.13.1' - - - uses: actions/checkout@v2 - with: - path: 'app' - - - run: | - cd app - flutter config --enable-macos-desktop - flutter pub get - flutter build macos --release - cd build/macos/Build/Products/Release - ditto -c -k --sequesterRsrc --keepParent github_ci_tesing.app macos-release.zip - - - run: | - cd app - npm i - npm run upload macos ${{ secrets.ACCOUNT }} - - - uses: ncipollo/release-action@v1 - with: - artifacts: 'app/build/macOS/Build/Products/Release/macos-release.zip' - token: ${{ secrets.TOKEN }} - allowUpdates: true - - windows: - name: Windows - runs-on: windows-latest - steps: - - run: | - git clone https://github.com/flutter/flutter.git - cd flutter - git checkout 4df8fdb7df - - run: echo ::add-path::"$(pwd)\flutter\bin" - - - uses: actions/setup-node@v1 - with: - node-version: '12.13.1' - - - uses: actions/checkout@v2 - with: - path: 'app' - - - run: | - cd app - flutter config --enable-windows-desktop - flutter pub get - flutter build windows --release - cd build\windows\x64\Release - Compress-Archive -Path Runner -DestinationPath windows-release.zip - - # Windows prints the secret variable in log taht's why It's disabled for now - # - run: | - # cd app - # npm i - # npm run upload windows ${{ secrets.ACCOUNT }} - - - name: Windows release build for github - uses: ncipollo/release-action@v1 - with: - artifacts: 'app\build\windows\x64\Release\windows-release.zip' - token: ${{ secrets.TOKEN }} - allowUpdates: true diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml new file mode 100644 index 0000000..897e944 --- /dev/null +++ b/.github/workflows/web.yml @@ -0,0 +1,65 @@ +on: + push: + tags: + - "*" + +name: Web build and release +jobs: + build: + name: Web + runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.24.5" + cache: true + channel: "stable" + + - uses: actions/checkout@v4 + with: + path: "app" + - uses: oven-sh/setup-bun@v2 + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Build web release + run: | + cd app + flutter config --enable-web + flutter pub get + flutter build web -t lib/main.web.dart --release --no-tree-shake-icons --wasm + + - name: Deploy cloudflare pages + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + packageManager: "bun" + command: pages deploy ./app/build/web --project-name=flutter-uis --branch=main + + # Deploy to Firebase + - name: Deploy to Firebase + uses: w9jds/firebase-action@master + with: + args: deploy --only hosting + env: + PROJECT_PATH: "app" + GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} + + # GitHub Pages deployment steps + - name: Upload artifact for GitHub Pages + uses: actions/upload-pages-artifact@v3 + with: + path: app/build/web + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..02443a1 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,38 @@ +on: + push: + tags: + - "*" + +name: Release Builds +jobs: + windows: + name: Windows + runs-on: windows-latest + steps: + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.24.5" + cache: true + channel: "stable" + + - uses: actions/checkout@v4 + with: + path: "app" + - name: Flutter enable windows + run: flutter config --enable-windows-desktop + - name: Install pub dependencies + run: cd app && flutter pub get + - name: Build windows release & compress it + run: | + cd app + flutter build windows --release + cd build\windows\x64\runner + Compress-Archive -Path Release -DestinationPath windows-release.zip + + - name: Windows release build for github + uses: ncipollo/release-action@v1 + with: + artifacts: 'app\build\windows\x64\runner\windows-release.zip' + token: ${{ secrets.TOKEN }} + allowUpdates: true