CI #6
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| actions: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| submodules: recursive | |
| - name: Pub cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.pub-cache | |
| key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }} | |
| restore-keys: ${{ runner.os }}-pub- | |
| - name: Setup Java (Temurin 17) | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| flutter-version: 3.38.1 | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Build APKs | |
| run: | | |
| flutter build apk --release | |
| # - name: Find APKs | |
| # if: github.event_name != 'pull_request' | |
| # run: | | |
| # APK_FILE=$(find build/app/outputs/flutter-apk -name 'app-release.apk') | |
| # echo 'APK_FILE=$APK_FILE' >> $GITHUB_ENV | |
| # echo 'APK_FILE_NAME=$(basename $APK_FILE .apk)' >> $GITHUB_ENV | |
| - name: Upload files to Telegram | |
| uses: xz-dev/TelegramFileUploader@v1.1.1 | |
| with: | |
| to-who: ${{ secrets.TELEGRAM_CHAT_ID }} | |
| message: ${{ github.sha }} | |
| files: | | |
| build/app/outputs/flutter-apk/app-release.apk | |
| env: | |
| API_ID: ${{ secrets.TELEGRAM_APP_API_ID }} | |
| API_HASH: ${{ secrets.TELEGRAM_APP_API_HASH }} | |
| BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} |