| name: Deploy to web |
| on: |
| # Enable manual run |
| workflow_dispatch: |
| inputs: |
| environment: |
| description: "Environment to deploy web build" |
| required: true |
| default: "staging" |
| type: choice |
| options: |
| - staging |
| - prod |
| |
| # Declare default permissions as read only. |
| permissions: read-all |
| |
| jobs: |
| build-and-deploy: |
| runs-on: ubuntu-latest |
| steps: |
| # Set up Flutter. |
| - name: Clone Flutter repository with master channel |
| uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225 |
| with: |
| channel: master |
| - run: flutter doctor -v |
| |
| - name: Install web dependencies |
| uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 |
| with: |
| node-version: "14" |
| - run: npm install -g firebase-tools@11.0.1 |
| |
| # Checkout gallery code and get packages. |
| - name: Checkout gallery code |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| - run: flutter pub get |
| |
| # Build and deploy (by default, to staging). |
| - run: flutter build -v web --release |
| - run: firebase deploy --only hosting:${{ github.event.inputs.environment || 'staging' }} |
| env: |
| FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} |