Setup Flutter Platforms and Build #2
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: Setup Flutter Platforms and Build | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| setup-and-build: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.38.7' | |
| - name: Enable iOS support | |
| run: | | |
| if [ ! -d "ios" ]; then | |
| flutter create --platforms ios . | |
| echo "iOS support enabled" | |
| else | |
| echo "iOS already configured" | |
| fi | |
| - name: Build iOS (debug) | |
| run: | | |
| flutter build ios --debug --no-codesign | |
| echo "iOS build completed" | |
| - name: Check for changes | |
| id: check-changes | |
| run: | | |
| git status --porcelain | |
| if git status --porcelain | grep -q .; then | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Configure Git | |
| if: steps.check-changes.outputs.changes_detected == 'true' | |
| run: | | |
| git config --global user.name "ILoveScratch" | |
| git config --global user.email "yaowendao2023@qq.com" | |
| - name: Commit and push changes | |
| if: steps.check-changes.outputs.changes_detected == 'true' | |
| run: | | |
| git add . | |
| git commit -m "chore: enable iOS platforms" | |
| git push https://github.com/ILoveScratch2/TouchFish-Client.git |