web build with temporary directory to store build/web #5
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: Deploy Cooketh Flow Web | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.29.2' | |
| channel: 'stable' | |
| - name: Enable web support | |
| run: flutter config --enable-web | |
| - name: Check Flutter setup | |
| run: flutter doctor | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Verify web configuration | |
| run: | | |
| if [ -f "web/index.html" ]; then | |
| echo "Web configuration found" | |
| else | |
| echo "Error: web/index.html not found. Ensure web support is enabled in your project." | |
| exit 1 | |
| fi | |
| - name: Build web | |
| run: flutter build web --release --web-renderer canvaskit | |
| - name: Debug build output | |
| run: | | |
| echo "Current directory: $(pwd)" | |
| ls -la | |
| if [ -d "build/web" ]; then | |
| echo "build/web exists" | |
| ls -la build/web | |
| else | |
| echo "Error: build/web directory not found" | |
| exit 1 | |
| fi | |
| - name: Copy build to temporary directory | |
| run: | | |
| mkdir -p /tmp/web-build | |
| cp -r build/web/* /tmp/web-build/ | |
| - name: Create or update web branch | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| git checkout -B web | |
| rm -rf ./* | |
| cp -r /tmp/web-build/* . | |
| git add . | |
| git commit -m "Deploy web build" || echo "No changes to commit" | |
| git push origin web --force | |
| - name: Debug web branch contents | |
| run: | | |
| echo "Web branch contents after deployment:" | |
| ls -la |