fix: CI ota job
This commit is contained in:
@@ -53,8 +53,10 @@ jobs:
|
|||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
|
|
||||||
- name: Install EAS CLI
|
- name: Install EAS CLI & cache deps
|
||||||
run: npm install -g eas-cli
|
run: |
|
||||||
|
npm install -g eas-cli
|
||||||
|
pip install -r scripts/requirements.txt --quiet
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
working-directory: frontend-admin
|
working-directory: frontend-admin
|
||||||
@@ -78,17 +80,36 @@ jobs:
|
|||||||
echo "profile=pre-prod" >> $GITHUB_OUTPUT
|
echo "profile=pre-prod" >> $GITHUB_OUTPUT
|
||||||
echo "channel=pre-prod" >> $GITHUB_OUTPUT
|
echo "channel=pre-prod" >> $GITHUB_OUTPUT
|
||||||
echo "api_url=https://5.181.0.112.nip.io" >> $GITHUB_OUTPUT
|
echo "api_url=https://5.181.0.112.nip.io" >> $GITHUB_OUTPUT
|
||||||
echo "apk_name=admin-panel-preview-$(date +%Y%m%d-%H%M).apk" >> $GITHUB_OUTPUT
|
echo "apk_name=admin-panel-pre-prod-$(date +%Y%m%d-%H%M).apk" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Restore Gradle cache (RustFS)
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.RUSTFS_ACCESS_KEY }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUSTFS_SECRET_KEY }}
|
||||||
|
S3_ENDPOINT: https://s3.uber-stup.club
|
||||||
|
S3_BUCKET: apk-builds
|
||||||
|
run: python scripts/eas_cache.py restore --app frontend-admin
|
||||||
|
|
||||||
- name: Build APK (local)
|
- name: Build APK (local)
|
||||||
working-directory: frontend-admin
|
working-directory: frontend-admin
|
||||||
env:
|
env:
|
||||||
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
||||||
EXPO_PUBLIC_API_URL: ${{ steps.config.outputs.api_url }}
|
EXPO_PUBLIC_API_URL: ${{ steps.config.outputs.api_url }}
|
||||||
EAS_BUILD_NO_EXPO_GO_WARNING: true
|
EAS_BUILD_NO_EXPO_GO_WARNING: true
|
||||||
|
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError"
|
||||||
|
JAVA_TOOL_OPTIONS: "-Xmx4096m"
|
||||||
run: eas build --platform android --profile ${{ steps.config.outputs.profile }} --local --non-interactive
|
run: eas build --platform android --profile ${{ steps.config.outputs.profile }} --local --non-interactive
|
||||||
|
|
||||||
|
- name: Save Gradle cache (RustFS)
|
||||||
|
if: success() || failure()
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.RUSTFS_ACCESS_KEY }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUSTFS_SECRET_KEY }}
|
||||||
|
S3_ENDPOINT: https://s3.uber-stup.club
|
||||||
|
S3_BUCKET: apk-builds
|
||||||
|
run: python scripts/eas_cache.py save --app frontend-admin
|
||||||
|
|
||||||
- name: Rename APK
|
- name: Rename APK
|
||||||
working-directory: frontend-admin
|
working-directory: frontend-admin
|
||||||
run: mv *.apk ${{ steps.config.outputs.apk_name }}
|
run: mv *.apk ${{ steps.config.outputs.apk_name }}
|
||||||
@@ -124,9 +145,6 @@ jobs:
|
|||||||
working-directory: frontend-admin
|
working-directory: frontend-admin
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Install EAS CLI
|
|
||||||
run: npm install -g eas-cli
|
|
||||||
|
|
||||||
- name: Determine channel & env
|
- name: Determine channel & env
|
||||||
id: config
|
id: config
|
||||||
run: |
|
run: |
|
||||||
@@ -137,22 +155,28 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "channel=pre-prod" >> $GITHUB_OUTPUT
|
echo "channel=pre-prod" >> $GITHUB_OUTPUT
|
||||||
echo "api_url=https://5.181.0.112.nip.io" >> $GITHUB_OUTPUT
|
echo "api_url=https://5.181.0.112.nip.io" >> $GITHUB_OUTPUT
|
||||||
echo "message=Preview update $(date +%Y%m%d-%H%M)" >> $GITHUB_OUTPUT
|
echo "message=Pre-prod update $(date +%Y%m%d-%H%M)" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Inject EAS project ID
|
||||||
|
working-directory: frontend-admin
|
||||||
|
run: |
|
||||||
|
jq '.expo.extra.eas.projectId = "${{ secrets.EXPO_PROJECT_ID }}"' app.json > app.tmp.json
|
||||||
|
mv app.tmp.json app.json
|
||||||
|
|
||||||
- name: Publish OTA update to Xavia
|
- name: Publish OTA update to Xavia
|
||||||
working-directory: frontend-admin
|
working-directory: frontend-admin
|
||||||
env:
|
env:
|
||||||
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
||||||
EXPO_PUBLIC_API_URL: ${{ steps.config.outputs.api_url }}
|
EXPO_PUBLIC_API_URL: ${{ steps.config.outputs.api_url }}
|
||||||
XAVIA_SERVER_URL: https://ota.uber-stup.club
|
|
||||||
run: |
|
run: |
|
||||||
npx expo export --platform android
|
RUNTIME_VERSION=$(jq -r '.expo.runtimeVersion // .expo.version' app.json)
|
||||||
curl -X POST "$XAVIA_SERVER_URL/api/updates" \
|
npx expo export --platform android --output-dir dist
|
||||||
|
cd dist && zip -r ../bundle.zip . && cd ..
|
||||||
|
curl -X POST "https://ota.uber-stup.club/api/upload" \
|
||||||
-H "Authorization: Bearer ${{ secrets.XAVIA_API_KEY }}" \
|
-H "Authorization: Bearer ${{ secrets.XAVIA_API_KEY }}" \
|
||||||
-H "Content-Type: application/json" \
|
-F "file=@bundle.zip" \
|
||||||
-d '{
|
-F "runtimeVersion=$RUNTIME_VERSION" \
|
||||||
"channel": "${{ steps.config.outputs.channel }}",
|
-F "commitHash=${{ github.sha }}" \
|
||||||
"message": "${{ steps.config.outputs.message }}",
|
-F "commitMessage=${{ steps.config.outputs.message }}" \
|
||||||
"platform": "android"
|
--fail
|
||||||
}'
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Frontend Admin - EAS Build
|
name: Frontend Client - EAS Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -80,7 +80,7 @@ jobs:
|
|||||||
echo "profile=pre-prod" >> $GITHUB_OUTPUT
|
echo "profile=pre-prod" >> $GITHUB_OUTPUT
|
||||||
echo "channel=pre-prod" >> $GITHUB_OUTPUT
|
echo "channel=pre-prod" >> $GITHUB_OUTPUT
|
||||||
echo "api_url=https://5.181.0.112.nip.io" >> $GITHUB_OUTPUT
|
echo "api_url=https://5.181.0.112.nip.io" >> $GITHUB_OUTPUT
|
||||||
echo "apk_name=mobile-preview-$(date +%Y%m%d-%H%M).apk" >> $GITHUB_OUTPUT
|
echo "apk_name=mobile-pre-prod-$(date +%Y%m%d-%H%M).apk" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Restore Gradle cache (RustFS)
|
- name: Restore Gradle cache (RustFS)
|
||||||
@@ -145,9 +145,6 @@ jobs:
|
|||||||
working-directory: mobile
|
working-directory: mobile
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Install EAS CLI
|
|
||||||
run: npm install -g eas-cli
|
|
||||||
|
|
||||||
- name: Determine channel & env
|
- name: Determine channel & env
|
||||||
id: config
|
id: config
|
||||||
run: |
|
run: |
|
||||||
@@ -158,22 +155,28 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "channel=pre-prod" >> $GITHUB_OUTPUT
|
echo "channel=pre-prod" >> $GITHUB_OUTPUT
|
||||||
echo "api_url=https://5.181.0.112.nip.io" >> $GITHUB_OUTPUT
|
echo "api_url=https://5.181.0.112.nip.io" >> $GITHUB_OUTPUT
|
||||||
echo "message=Preview update $(date +%Y%m%d-%H%M)" >> $GITHUB_OUTPUT
|
echo "message=Pre-prod update $(date +%Y%m%d-%H%M)" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Inject EAS project ID
|
||||||
|
working-directory: mobile
|
||||||
|
run: |
|
||||||
|
jq '.expo.extra.eas.projectId = "${{ secrets.EXPO_PROJECT_ID_CLIENT }}"' app.json > app.tmp.json
|
||||||
|
mv app.tmp.json app.json
|
||||||
|
|
||||||
- name: Publish OTA update to Xavia
|
- name: Publish OTA update to Xavia
|
||||||
working-directory: mobile
|
working-directory: mobile
|
||||||
env:
|
env:
|
||||||
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
||||||
EXPO_PUBLIC_API_URL: ${{ steps.config.outputs.api_url }}
|
EXPO_PUBLIC_API_URL: ${{ steps.config.outputs.api_url }}
|
||||||
XAVIA_SERVER_URL: https://ota.uber-stup.club
|
|
||||||
run: |
|
run: |
|
||||||
npx expo export --platform android
|
RUNTIME_VERSION=$(jq -r '.expo.runtimeVersion // .expo.version' app.json)
|
||||||
curl -X POST "$XAVIA_SERVER_URL/api/updates" \
|
npx expo export --platform android --output-dir dist
|
||||||
|
cd dist && zip -r ../bundle.zip . && cd ..
|
||||||
|
curl -X POST "https://ota.uber-stup.club/api/upload" \
|
||||||
-H "Authorization: Bearer ${{ secrets.XAVIA_API_KEY }}" \
|
-H "Authorization: Bearer ${{ secrets.XAVIA_API_KEY }}" \
|
||||||
-H "Content-Type: application/json" \
|
-F "file=@bundle.zip" \
|
||||||
-d '{
|
-F "runtimeVersion=$RUNTIME_VERSION" \
|
||||||
"channel": "${{ steps.config.outputs.channel }}",
|
-F "commitHash=${{ github.sha }}" \
|
||||||
"message": "${{ steps.config.outputs.message }}",
|
-F "commitMessage=${{ steps.config.outputs.message }}" \
|
||||||
"platform": "android"
|
--fail
|
||||||
}'
|
|
||||||
|
|||||||
Reference in New Issue
Block a user