Skip to content
Merged
45 changes: 45 additions & 0 deletions .github/actions/setup-flutter-app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'Setup Flutter App'
description: 'Set up Flutter with dependencies, caching, and optional code generation'
inputs:
google-services-json:
description: 'Firebase google-services.json content'
required: true
generate-mocks:
description: 'Whether to run build_runner for mock generation'
required: false
default: 'false'
flutter-version:
description: 'Flutter version to use'
required: false
default: '3.38.3'

runs:
using: 'composite'
steps:
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter-version }}
channel: 'stable'
cache: true

- name: Cache Flutter pub dependencies
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-

- name: Create Firebase google-services.json
shell: bash
run: echo '${{ inputs.google-services-json }}' > android/app/google-services.json

- name: Get dependencies
shell: bash
run: flutter pub get

- name: Generate mocks
if: inputs.generate-mocks == 'true'
shell: bash
run: dart run build_runner build --delete-conflicting-outputs
4 changes: 2 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,12 @@ The app has three deployment environments:
2. **Staging** (`staging.cambeerfestival.app`)
- Deployed automatically on push to `main`
- Cloudflare Pages, branch `main`
- Workflow: `.github/workflows/build-deploy.yml`
- Workflow: `.github/workflows/ci.yml`

3. **PR Previews**
- Unique URL per pull request
- Preview URL posted as comment on PR
- Workflow: `.github/workflows/build-deploy.yml`
- Workflow: `.github/workflows/ci.yml`

### Deployment Workflow

Expand Down
61 changes: 16 additions & 45 deletions .github/workflows/build-deploy.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Flutter App CI/CD
name: CI

on:
push:
Expand Down Expand Up @@ -55,21 +55,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
- name: Setup Flutter App
uses: ./.github/actions/setup-flutter-app
with:
flutter-version: '3.38.3'
channel: 'stable'
cache: true

- name: Create Firebase google-services.json
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > android/app/google-services.json

- name: Get dependencies
run: flutter pub get

- name: Generate mocks
run: dart run build_runner build --delete-conflicting-outputs
google-services-json: ${{ secrets.GOOGLE_SERVICES_JSON }}
generate-mocks: 'true'

- name: Analyze code
run: flutter analyze --no-fatal-infos
Expand Down Expand Up @@ -106,24 +96,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
- name: Setup Flutter App
uses: ./.github/actions/setup-flutter-app
with:
flutter-version: '3.38.3'
channel: 'stable'
cache: true

- name: Create Firebase google-services.json
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > android/app/google-services.json

- name: Get dependencies
run: flutter pub get
google-services-json: ${{ secrets.GOOGLE_SERVICES_JSON }}

- name: Get git version info
id: git_version
run: |
chmod +x scripts/get_version_info.sh
scripts/get_version_info.sh github >> $GITHUB_OUTPUT
run: scripts/get_version_info.sh github >> $GITHUB_OUTPUT

- name: Build web
run: |
Expand Down Expand Up @@ -151,7 +131,8 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '21'
node-version: '20'
cache: 'npm'

- name: Download web build artifact
uses: actions/download-artifact@v4
Expand All @@ -160,7 +141,7 @@ jobs:
path: build/web

- name: Install npm dependencies
run: npm install
run: npm ci

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
Expand Down Expand Up @@ -221,24 +202,14 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-

- name: Setup Flutter
uses: subosito/flutter-action@v2
- name: Setup Flutter App
uses: ./.github/actions/setup-flutter-app
with:
flutter-version: '3.38.3'
channel: 'stable'
cache: true

- name: Create Firebase google-services.json
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > android/app/google-services.json

- name: Get dependencies
run: flutter pub get
google-services-json: ${{ secrets.GOOGLE_SERVICES_JSON }}

- name: Get git version info
id: git_version
run: |
chmod +x scripts/get_version_info.sh
scripts/get_version_info.sh github >> $GITHUB_OUTPUT
run: scripts/get_version_info.sh github >> $GITHUB_OUTPUT

- name: Build debug APK
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cloudflare Worker
name: Deploy Worker

on:
push:
Expand Down Expand Up @@ -83,6 +83,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: cloudflare-worker/package-lock.json

- name: Install worker dependencies
working-directory: cloudflare-worker
Expand Down Expand Up @@ -116,6 +118,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Validate festivals.json
if: |
Expand Down
Loading
Loading