Skip to content

Commit fb6389b

Browse files
committed
add action to automatically update artifacts in GCS bucket
1 parent b052cfd commit fb6389b

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: deploy
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
main:
10+
runs-on: macos-latest
11+
12+
steps:
13+
- name: Clone repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Java
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: zulu
20+
java-version: 21
21+
22+
- name: Set up Flutter
23+
uses: subosito/flutter-action@v2
24+
with:
25+
channel: stable
26+
flutter-version-file: pubspec.yaml
27+
28+
- name: Download pub dependencies
29+
run: flutter pub get
30+
31+
- name: Build Android app
32+
run: flutter build apk --debug
33+
34+
- name: Build iOS app
35+
run: flutter build ios --debug --simulator
36+
37+
- name: Upload iOS app to artifacts
38+
uses: actions/upload-artifact@v4
39+
if: success() || failure()
40+
with:
41+
name: demo_app.apk
42+
path: build/app/outputs/flutter-apk/demo_app.apk
43+
retention-days: 1
44+
45+
- name: Upload iOS artifacts
46+
uses: actions/upload-artifact@v4
47+
if: success() || failure()
48+
with:
49+
name: demo_app.app
50+
path: build/ios/iphonesimulator/demo_app.app
51+
retention-days: 1
52+
53+
- name: Authenticate to Google Cloud
54+
uses: google-github-actions/auth@v2
55+
with:
56+
# These credentials should only have write access to the bucket
57+
credentials_json: ${{ secrets.GCP_MOBILEDEV_BUCKET_CREDENTIALS }}
58+
59+
- name: Set up Google Cloud CLI
60+
uses: google-github-actions/setup-gcloud@v2
61+
with:
62+
version: ">= 484.0.0"
63+
project_id: perf-dev-289002
64+
65+
- name: Upload apps to public Google Cloud Storage bucket
66+
run: ./upload_to_gcs

upload_to_gcs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
# Upload Android app
5+
UPLOAD_PATH="gs://mobile.dev/cli_e2e"
6+
7+
cd build/app/outputs/flutter-apk
8+
cp app-debug.apk demo_app.apk
9+
cd -
10+
11+
gsutil cp build/app/outputs/flutter-apk/demo_app.apk "$UPLOAD_PATH/demo_app.apk"
12+
gsutil acl ch -r -u AllUsers:R "$UPLOAD_PATH/demo_app.apk"
13+
14+
# Upload iOS app
15+
cd build/ios/iphonesimulator
16+
cp Runner.app demo_app.app
17+
cd demo_app.app
18+
19+
zip -r -q ../demo_app.zip . -x "/**/.*" -x "__MACOSX"
20+
21+
cd ..
22+
cd ../../../
23+
24+
gsutil cp build/ios/iphonesimulator/demo_app.zip "$UPLOAD_PATH/demo_app.zip"
25+
gsutil acl ch -r -u AllUsers:R "$UPLOAD_PATH/demo_app.zip"

0 commit comments

Comments
 (0)