-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from nozomi-koborinai/feature/add-workflows
Feature/add workflows
- Loading branch information
Showing
11 changed files
with
314 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "flutter-gakkai-07" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"flutterSdkVersion": "3.27.1", | ||
"flavors": {} | ||
} |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: CD for Cloud Run Functions on Firebase | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "genkit/**" | ||
|
||
jobs: | ||
changes: | ||
name: Detect Changes | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
contents: read | ||
timeout-minutes: 15 | ||
outputs: | ||
genkit_functions: ${{ steps.filter.outputs.genkit_functions }} | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Detect changes | ||
uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
genkit_functions: | ||
- 'genkit/**' | ||
deploy_functions: | ||
name: Deploy Cloud Run Functions | ||
needs: | ||
- changes | ||
if: ${{ needs.changes.outputs.genkit_functions == 'true' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: "Authenticate to Google Cloud" | ||
uses: "google-github-actions/auth@v2" | ||
with: | ||
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} | ||
service_account: ${{ secrets.SERVICE_ACCOUNT_MAIL }} | ||
create_credentials_file: true | ||
export_environment_variables: true | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install Dependencies | ||
working-directory: ./genkit | ||
run: npm install | ||
|
||
- name: Deploy to Functions | ||
run: | | ||
npm install -g firebase-tools | ||
firebase deploy --only functions --force --project=${{ secrets.PROJECT_ID }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: CI for Cloud Run Functions on Firebase | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "genkit/**" | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
jobs: | ||
changes: | ||
name: Detect Changes | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
contents: read | ||
timeout-minutes: 15 | ||
outputs: | ||
genkit_functions: ${{ steps.filter.outputs.genkit_functions }} | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Detect changes | ||
uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
genkit_functions: | ||
- 'genkit/**' | ||
functions_ci: | ||
name: Cloud Run Functions CI | ||
needs: | ||
- changes | ||
if: ${{ needs.changes.outputs.genkit_functions == 'true' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install Dependencies | ||
working-directory: ./genkit | ||
run: npm install | ||
|
||
- name: Check for linting errors | ||
working-directory: ./genkit | ||
run: npm run lint |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Deploy to Firebase Hosting on merge | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "genkit/**" | ||
|
||
jobs: | ||
build_and_deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Read Flutter SDK version | ||
run: echo "FLUTTER_VERSION=$(jq -r '.flutterSdkVersion' .fvm/fvm_config.json)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Create Firebase options file | ||
run: | | ||
cat <<EOF > ./lib/firebase_options.dart | ||
${{ secrets.FIREBASE_CONFIG }} | ||
EOF | ||
- name: Create dot_env file | ||
run: | | ||
cat <<EOF > ./.env | ||
${{ secrets.DOT_ENV }} | ||
EOF | ||
- name: Setup Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: ${{ env.FLUTTER_VERSION }} | ||
|
||
- name: flutter pub get | ||
run: flutter pub get | ||
|
||
- name: flutter build web | ||
run: flutter build web | ||
|
||
- name: "Authenticate to Google Cloud" | ||
uses: "google-github-actions/auth@v2" | ||
with: | ||
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} | ||
service_account: ${{ secrets.SERVICE_ACCOUNT_MAIL }} | ||
create_credentials_file: true | ||
export_environment_variables: true | ||
|
||
- name: Deploy to Firebase Hosting | ||
run: | | ||
npm install -g firebase-tools | ||
firebase deploy --only hosting --project=${{ secrets.PROJECT_ID }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Preview Deploy to Firebase Hosting on merge | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
paths-ignore: | ||
- "genkit/**" | ||
jobs: | ||
build_and_deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Read Flutter SDK version | ||
run: echo "FLUTTER_VERSION=$(jq -r '.flutterSdkVersion' .fvm/fvm_config.json)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Create Firebase options file | ||
run: | | ||
cat <<EOF > ./lib/firebase_options.dart | ||
${{ secrets.FIREBASE_CONFIG }} | ||
EOF | ||
- name: Create dot_env file | ||
run: | | ||
cat <<EOF > ./.env | ||
${{ secrets.DOT_ENV }} | ||
EOF | ||
- name: Setup Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
flutter-version: ${{ env.FLUTTER_VERSION }} | ||
|
||
- name: flutter pub get | ||
run: flutter pub get | ||
|
||
- name: flutter build web | ||
run: flutter build web | ||
|
||
- name: "Authenticate to Google Cloud" | ||
uses: "google-github-actions/auth@v2" | ||
with: | ||
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} | ||
service_account: ${{ secrets.SERVICE_ACCOUNT_MAIL }} | ||
create_credentials_file: true | ||
export_environment_variables: true | ||
|
||
- name: Preview Deploy to Firebase Hosting | ||
run: | | ||
npm install -g firebase-tools | ||
firebase hosting:channel:deploy preview --project=${{ secrets.PROJECT_ID }} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"flutter": { | ||
"platforms": { | ||
"dart": { | ||
"lib/firebase_options.dart": { | ||
"projectId": "flutter-gakkai-07", | ||
"configurations": { | ||
"web": "1:463090427578:web:7f5a01f865f5c3a6efc483" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"functions": [ | ||
{ | ||
"source": "genkit", | ||
"codebase": "default", | ||
"ignore": [ | ||
"node_modules", | ||
".git", | ||
"firebase-debug.log", | ||
"firebase-debug.*.log", | ||
"*.local" | ||
], | ||
"predeploy": [ | ||
"npm --prefix \"$RESOURCE_DIR\" run lint", | ||
"npm --prefix \"$RESOURCE_DIR\" run build" | ||
] | ||
} | ||
], | ||
"emulators": { | ||
"auth": { | ||
"port": 9099 | ||
}, | ||
"functions": { | ||
"port": 5001 | ||
}, | ||
"firestore": { | ||
"port": 8080 | ||
}, | ||
"ui": { | ||
"enabled": true | ||
}, | ||
"singleProjectMode": true | ||
}, | ||
"hosting": { | ||
"public": "build/web", | ||
"ignore": [ | ||
"firebase.json", | ||
"**/.* !**/.env", | ||
"**/node_modules/**" | ||
] | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "flutter-gakkai-07" | ||
} | ||
} |
This file contains 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