-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add action to automatically update artifacts in GCS bucket
- Loading branch information
1 parent
b052cfd
commit fb6389b
Showing
2 changed files
with
91 additions
and
0 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,66 @@ | ||
name: deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
main: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: zulu | ||
java-version: 21 | ||
|
||
- name: Set up Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
channel: stable | ||
flutter-version-file: pubspec.yaml | ||
|
||
- name: Download pub dependencies | ||
run: flutter pub get | ||
|
||
- name: Build Android app | ||
run: flutter build apk --debug | ||
|
||
- name: Build iOS app | ||
run: flutter build ios --debug --simulator | ||
|
||
- name: Upload iOS app to artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: success() || failure() | ||
with: | ||
name: demo_app.apk | ||
path: build/app/outputs/flutter-apk/demo_app.apk | ||
retention-days: 1 | ||
|
||
- name: Upload iOS artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: success() || failure() | ||
with: | ||
name: demo_app.app | ||
path: build/ios/iphonesimulator/demo_app.app | ||
retention-days: 1 | ||
|
||
- name: Authenticate to Google Cloud | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
# These credentials should only have write access to the bucket | ||
credentials_json: ${{ secrets.GCP_MOBILEDEV_BUCKET_CREDENTIALS }} | ||
|
||
- name: Set up Google Cloud CLI | ||
uses: google-github-actions/setup-gcloud@v2 | ||
with: | ||
version: ">= 484.0.0" | ||
project_id: perf-dev-289002 | ||
|
||
- name: Upload apps to public Google Cloud Storage bucket | ||
run: ./upload_to_gcs |
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,25 @@ | ||
#!/usr/bin/env sh | ||
set -eu | ||
|
||
# Upload Android app | ||
UPLOAD_PATH="gs://mobile.dev/cli_e2e" | ||
|
||
cd build/app/outputs/flutter-apk | ||
cp app-debug.apk demo_app.apk | ||
cd - | ||
|
||
gsutil cp build/app/outputs/flutter-apk/demo_app.apk "$UPLOAD_PATH/demo_app.apk" | ||
gsutil acl ch -r -u AllUsers:R "$UPLOAD_PATH/demo_app.apk" | ||
|
||
# Upload iOS app | ||
cd build/ios/iphonesimulator | ||
cp Runner.app demo_app.app | ||
cd demo_app.app | ||
|
||
zip -r -q ../demo_app.zip . -x "/**/.*" -x "__MACOSX" | ||
|
||
cd .. | ||
cd ../../../ | ||
|
||
gsutil cp build/ios/iphonesimulator/demo_app.zip "$UPLOAD_PATH/demo_app.zip" | ||
gsutil acl ch -r -u AllUsers:R "$UPLOAD_PATH/demo_app.zip" |