-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: github ci support daily build dev #6552
base: x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,204 @@ | ||||||
name: Shared Environment Variables Setup | ||||||
description: Setup environment variables for the project | ||||||
|
||||||
inputs: | ||||||
additional_env: | ||||||
required: false | ||||||
type: string | ||||||
description: "Additional environment variables to inject" | ||||||
env_file_name: | ||||||
required: false | ||||||
type: string | ||||||
default: ".env" | ||||||
description: "Target environment file name" | ||||||
sentry_project: | ||||||
required: false | ||||||
type: string | ||||||
default: '' | ||||||
description: "Sentry project name" | ||||||
covalent_key: | ||||||
required: true | ||||||
type: string | ||||||
description: "Covalent API Key" | ||||||
sentry_token: | ||||||
required: true | ||||||
type: string | ||||||
description: "Sentry Auth Token" | ||||||
privy_app_id: | ||||||
required: true | ||||||
type: string | ||||||
description: "Privy App ID" | ||||||
privy_mobile_client_id: | ||||||
required: true | ||||||
type: string | ||||||
description: "Privy Mobile Client ID" | ||||||
revenuecat_api_key_web: | ||||||
required: true | ||||||
type: string | ||||||
description: "RevenueCat Web API Key" | ||||||
revenuecat_api_key_web_sandbox: | ||||||
required: true | ||||||
type: string | ||||||
description: "RevenueCat Web Sandbox API Key" | ||||||
revenuecat_api_key_apple: | ||||||
required: true | ||||||
type: string | ||||||
description: "RevenueCat Apple API Key" | ||||||
revenuecat_api_key_google: | ||||||
required: true | ||||||
type: string | ||||||
description: "RevenueCat Google API Key" | ||||||
|
||||||
runs: | ||||||
using: "composite" | ||||||
steps: | ||||||
- name: Checkout Source Code | ||||||
uses: actions/checkout@v3 | ||||||
with: | ||||||
lfs: true | ||||||
|
||||||
- name: Download workflow parameters | ||||||
if: ${{ github.event.workflow_run }} | ||||||
uses: dawidd6/action-download-artifact@v2 | ||||||
with: | ||||||
workflow: daily-build-dev | ||||||
name: workflow-params | ||||||
run_id: ${{ github.event.workflow_run.id }} | ||||||
|
||||||
- name: Load workflow parameters | ||||||
if: ${{ github.event.workflow_run }} | ||||||
run: | | ||||||
if [ -f params.env ]; then | ||||||
cat params.env >> $GITHUB_ENV | ||||||
fi | ||||||
Comment on lines
+68
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Loading Workflow Parameters. |
||||||
- name: Switch to target branch | ||||||
if: ${{ github.event.workflow_run }} | ||||||
shell: bash | ||||||
run: | | ||||||
if [ ! -z "${{ env.WORKFLOW_GITHUB_REF_NAME }}" ]; then | ||||||
echo "Switching to branch: ${{ env.WORKFLOW_GITHUB_REF_NAME }}" | ||||||
git fetch origin ${{ env.WORKFLOW_GITHUB_REF_NAME }} | ||||||
git checkout ${{ env.WORKFLOW_GITHUB_REF_NAME }} | ||||||
fi | ||||||
Comment on lines
+75
to
+83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Branch Switching Mechanism. |
||||||
- name: Dotenv Action | ||||||
id: dotenv | ||||||
uses: OneKeyHQ/actions/dotenv-action@main | ||||||
with: | ||||||
path: .env.version | ||||||
|
||||||
- name: Setup ENV | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Eliminate Unnecessary Spaces. Proposed diff: - id: dotenv
+ id: dotenv
🧰 Tools🪛 YAMLlint (1.35.1)[error] 91-91: trailing spaces (trailing-spaces) |
||||||
shell: bash | ||||||
run: | | ||||||
# Generate app version ------- start | ||||||
app_version=${{ steps.dotenv.outputs.version }} | ||||||
echo '$app_version='$app_version | ||||||
echo "BUILD_APP_VERSION=$app_version" >> $GITHUB_ENV | ||||||
# Generate app version ------- end | ||||||
# Generate github tag ------- start | ||||||
github_ref="${github_ref////-}" | ||||||
github_ref="${github_ref/refs-heads-/}" | ||||||
github_ref="${github_ref/refs-tags-/}" | ||||||
echo '$github_ref='$github_ref | ||||||
echo "GITHUB_TAG=$github_ref" >> $GITHUB_ENV | ||||||
# echo "::set-env name=GITHUB_TAG::$github_ref" | ||||||
# Generate github tag ------- end | ||||||
env: | ||||||
github_ref: ${{ github.ref }} | ||||||
workflow_run_number: ${{ github.event.workflow_run.run_number}} | ||||||
|
||||||
- name: Setup ENV BUILD_NUMBER to 1 | ||||||
if: ${{ !github.event.workflow_run }} | ||||||
shell: bash | ||||||
run: | | ||||||
# Generate build number ------- start | ||||||
echo "BUILD_NUMBER=1" >> $GITHUB_ENV | ||||||
# Generate build number ------- end | ||||||
env: | ||||||
github_ref: ${{ github.ref }} | ||||||
workflow_run_number: ${{ github.event.workflow_run.run_number}} | ||||||
|
||||||
|
||||||
- name: Setup ENV BUILD_NUMBER by workflow_run | ||||||
if: ${{ github.event.workflow_run }} | ||||||
shell: bash | ||||||
run: | | ||||||
echo "ActionTriggerBy = ${{ github.event.action }} / ${{ github.event_name }}" | ||||||
if [ ! -z "${{ env.WORKFLOW_BUILD_NUMBER }}" ]; then | ||||||
echo "BUILD_NUMBER=${{ env.WORKFLOW_BUILD_NUMBER }}" >> $GITHUB_ENV | ||||||
else | ||||||
# Generate build number ------- start | ||||||
DATE=`date "+%Y%m%d"` | ||||||
run_number=$(($workflow_run_number % 100)) | ||||||
run_number=$(printf "%02d" $run_number) | ||||||
build_number="${DATE}${run_number}" | ||||||
echo '$build_number='$build_number | ||||||
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV | ||||||
# Generate build number ------- end | ||||||
fi | ||||||
Comment on lines
+124
to
+142
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Dynamic Build Number Generation. |
||||||
env: | ||||||
github_ref: ${{ github.ref }} | ||||||
workflow_run_number: ${{ github.event.workflow_run.run_number}} | ||||||
|
||||||
- name: Inject Environment Variables | ||||||
shell: bash | ||||||
env: | ||||||
GITHUB_SHA: ${{ github.sha }} | ||||||
COVALENT_KEY: ${{ inputs.covalent_key }} | ||||||
SENTRY_TOKEN: ${{ inputs.sentry_token }} | ||||||
SENTRY_PROJECT: ${{ inputs.sentry_project || '' }} | ||||||
TARGET_ENV_FILE: ${{ inputs.env_file_name || '.env' }} | ||||||
PRIVY_APP_ID: ${{ inputs.privy_app_id }} | ||||||
PRIVY_MOBILE_CLIENT_ID: ${{ inputs.privy_mobile_client_id }} | ||||||
REVENUECAT_API_KEY_WEB: ${{ inputs.revenuecat_api_key_web }} | ||||||
REVENUECAT_API_KEY_WEB_SANDBOX: ${{ inputs.revenuecat_api_key_web_sandbox }} | ||||||
REVENUECAT_API_KEY_APPLE: ${{ inputs.revenuecat_api_key_apple }} | ||||||
REVENUECAT_API_KEY_GOOGLE: ${{ inputs.revenuecat_api_key_google }} | ||||||
run: | | ||||||
echo "GITHUB_SHA=${{ env.GITHUB_SHA }}" >> ${TARGET_ENV_FILE} | ||||||
echo "GITHUB_TAG=${{ env.GITHUB_TAG }}" >> ${TARGET_ENV_FILE} | ||||||
echo "CI_BUILD_APP_VERSION=${{ env.BUILD_APP_VERSION }}" >> ${TARGET_ENV_FILE} | ||||||
echo "CI_BUILD_NUMBER=${{ env.BUILD_NUMBER }}" >> ${TARGET_ENV_FILE} | ||||||
echo "ENABLE_ANALYZER=1" >> ${TARGET_ENV_FILE} | ||||||
echo "ENABLE_ANALYZER_HTML_REPORT=1" >> ${TARGET_ENV_FILE} | ||||||
echo "COVALENT_KEY=${{ env.COVALENT_KEY }}" >> ${TARGET_ENV_FILE} | ||||||
echo "SPLIT_BUNDLE=${{ inputs.is-split-bundle }}" >> ${TARGET_ENV_FILE} | ||||||
echo "SENTRY_AUTH_TOKEN=${{ env.SENTRY_TOKEN }}" >> ${TARGET_ENV_FILE} | ||||||
echo "SENTRY_TOKEN=${{ env.SENTRY_TOKEN }}" >> ${TARGET_ENV_FILE} | ||||||
echo "SENTRY_PROJECT=${{ env.SENTRY_PROJECT }}" >> ${TARGET_ENV_FILE} | ||||||
echo "PRIVY_APP_ID=${{ env.PRIVY_APP_ID }}" >> ${TARGET_ENV_FILE} | ||||||
echo "PRIVY_MOBILE_CLIENT_ID=${{ env.PRIVY_MOBILE_CLIENT_ID }}" >> ${TARGET_ENV_FILE} | ||||||
echo "REVENUECAT_API_KEY_WEB=${{ env.REVENUECAT_API_KEY_WEB }}" >> ${TARGET_ENV_FILE} | ||||||
echo "REVENUECAT_API_KEY_WEB_SANDBOX=${{ env.REVENUECAT_API_KEY_WEB_SANDBOX }}" >> ${TARGET_ENV_FILE} | ||||||
echo "REVENUECAT_API_KEY_APPLE=${{ env.REVENUECAT_API_KEY_APPLE }}" >> ${TARGET_ENV_FILE} | ||||||
echo "REVENUECAT_API_KEY_GOOGLE=${{ env.REVENUECAT_API_KEY_GOOGLE }}" >> ${TARGET_ENV_FILE} | ||||||
if [[ ! -z "${{ inputs.additional_env }}" ]]; then | ||||||
echo "${{ inputs.additional_env }}" >> ${TARGET_ENV_FILE} | ||||||
fi | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Trim Trailing Spaces in Injection Block. Proposed diff: - fi
+ fi 📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.35.1)[error] 181-181: trailing spaces (trailing-spaces) |
||||||
- name: Print ENV file content | ||||||
shell: bash | ||||||
run: | | ||||||
echo "=== .env ===" | ||||||
if [ -f .env ]; then | ||||||
cat .env | ||||||
fi | ||||||
echo "--------------------------------" | ||||||
echo "=== .env.expo ===" | ||||||
if [ -f .env.expo ]; then | ||||||
cat .env.expo | ||||||
fi | ||||||
echo "--------------------------------" | ||||||
echo "=== .env.version ===" | ||||||
if [ -f .env.version ]; then | ||||||
cat .env.version | ||||||
fi | ||||||
echo "--------------------------------" | ||||||
Comment on lines
+183
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Print ENV File Content for Debugging.
Comment on lines
+183
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 问题不大,github secrets 里的会自动变成 ****,其他的本身也会在前端代码里暴露出来 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 保险起见,这里先注释掉 |
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Remove Extra Blank Lines. Proposed diff: -
- 📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.35.1)[error] 204-204: too many blank lines (2 > 0) (empty-lines) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: daily-build-dev | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
daily-build: | ||
runs-on: ubuntu-latest | ||
# needs: get-commit-id | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- name: 'Setup ENV' | ||
run: | | ||
DATE=`date "+%Y%m%d"` | ||
run_number=$(($GITHUB_RUN_NUMBER % 100)) | ||
run_number=$(printf "%02d" $run_number) | ||
build_number="${DATE}${run_number}" | ||
echo '$build_number='$build_number | ||
#echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV | ||
echo "BUILD_NUMBER=1" >> $GITHUB_ENV | ||
- name: Save workflow parameters | ||
run: | | ||
mkdir -p ./workflow-data | ||
echo "WORKFLOW_GITHUB_REF_NAME=${{ github.ref_name }}" >> ./workflow-data/params.env | ||
echo "WORKFLOW_BUILD_NUMBER=1" >> ./workflow-data/params.env | ||
Comment on lines
+26
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Review the 'Save workflow parameters' step. 🧰 Tools🪛 YAMLlint (1.35.1)[error] 31-31: trailing spaces (trailing-spaces) |
||
- name: Upload workflow parameters | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: workflow-params | ||
path: workflow-data/params.env | ||
retention-days: 1 | ||
Comment on lines
+32
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Examine the 'Upload workflow parameters' step. |
||
|
||
|
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) End-of-file cleanup. 🧰 Tools🪛 YAMLlint (1.35.1)[error] 41-41: no new line character at the end of file (new-line-at-end-of-file) [error] 41-41: trailing spaces (trailing-spaces) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ on: | |
description: "Should it run as split-bundle? (keep it null if you don't need it)" | ||
required: false | ||
default: '' | ||
|
||
jobs: | ||
release-android-debug: | ||
runs-on: ubuntu-latest | ||
|
@@ -15,39 +16,28 @@ jobs: | |
node-version: [20.x] | ||
|
||
steps: | ||
# https://github.com/orgs/community/discussions/25678 | ||
- name: Delete huge unnecessary tools folder | ||
run: rm -rf /opt/hostedtoolcache | ||
|
||
Comment on lines
+19
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Duplicate deletion of tools folder detected. 🧰 Tools🪛 YAMLlint (1.35.1)[error] 22-22: trailing spaces (trailing-spaces) |
||
- name: Checkout Source Code | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
|
||
- name: Dotenv Action | ||
id: dotenv | ||
uses: OneKeyHQ/actions/dotenv-action@main | ||
- name: Run Shared Env Setup | ||
uses: ./.github/actions/shared-env | ||
with: | ||
path: .env.version | ||
|
||
- name: 'Setup ENV' | ||
run: | | ||
echo "ActionTriggerBy = ${{ github.event.action }} / ${{ github.event_name }}" | ||
|
||
# Generate build number ------- start | ||
DATE=`date "+%Y%m%d"` | ||
run_number=$(($workflow_run_number % 100)) | ||
run_number=$(printf "%02d" $run_number) | ||
build_number="${DATE}${run_number}" | ||
echo '$build_number='$build_number | ||
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV | ||
# Generate build number ------- end | ||
|
||
github_ref="${github_ref////-}" | ||
github_ref="${github_ref/refs-heads-/}" | ||
github_ref="${github_ref/refs-tags-/}" | ||
echo '$github_ref='$github_ref | ||
echo "GITHUB_TAG=$github_ref" >> $GITHUB_ENV | ||
# echo "::set-env name=GITHUB_TAG::$github_ref" | ||
env: | ||
github_ref: ${{ github.ref }} | ||
workflow_run_number: ${{ github.event.workflow_run.run_number}} | ||
env_file_name: ".env.expo" | ||
sentry_project: '' | ||
covalent_key: ${{ secrets.COVALENT_KEY }} | ||
sentry_token: ${{ secrets.SENTRY_TOKEN }} | ||
privy_app_id: ${{ secrets.PRIVY_APP_ID }} | ||
privy_mobile_client_id: ${{ secrets.PRIVY_MOBILE_CLIENT_ID }} | ||
revenuecat_api_key_web: ${{ secrets.REVENUECAT_API_KEY_WEB }} | ||
revenuecat_api_key_web_sandbox: ${{ secrets.REVENUECAT_API_KEY_WEB_SANDBOX }} | ||
revenuecat_api_key_apple: ${{ secrets.REVENUECAT_API_KEY_APPLE }} | ||
revenuecat_api_key_google: ${{ secrets.REVENUECAT_API_KEY_GOOGLE }} | ||
Comment on lines
+28
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Examine the 'Run Shared Env Setup' step. 🧰 Tools🪛 YAMLlint (1.35.1)[error] 28-28: trailing spaces (trailing-spaces) |
||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
|
@@ -83,12 +73,6 @@ jobs: | |
run: | | ||
yarn | ||
|
||
- name: Inject Environment Variables | ||
env: | ||
GITHUB_SHA: ${{ github.sha }} | ||
run: | | ||
echo "GITHUB_SHA=${{ env.GITHUB_SHA }}" >> .env | ||
|
||
- name: Build APK | ||
env: | ||
NODE_OPTIONS: '--max_old_space_size=8192' | ||
|
@@ -97,6 +81,10 @@ jobs: | |
yarn app:web-embed:build | ||
cd apps/mobile/android | ||
./gradlew assembleDebug | ||
|
||
# https://github.com/orgs/community/discussions/25678 | ||
- name: Delete huge unnecessary tools folder | ||
run: rm -rf /opt/hostedtoolcache | ||
|
||
Comment on lines
+85
to
88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Duplicate deletion of tools folder detected. 🧰 Tools🪛 YAMLlint (1.35.1)[error] 88-88: trailing spaces (trailing-spaces) |
||
- name: Upload Main Debug APK | ||
uses: actions/upload-artifact@v4 | ||
|
@@ -115,7 +103,17 @@ jobs: | |
- name: Upload Huawei Debug APK | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release-huawei-debug | ||
path: | | ||
./apps/mobile/android/app/build/outputs/apk/huawei/debug | ||
name: release-huawei-debug | ||
path: | | ||
./apps/mobile/android/app/build/outputs/apk/huawei/debug | ||
|
||
- name: Free Disk Space | ||
uses: jlumbroso/free-disk-space@main | ||
with: | ||
tool-cache: false | ||
android: true | ||
dotnet: false | ||
haskell: false | ||
large-packages: false | ||
docker-images: false | ||
swap-storage: false | ||
Comment on lines
+110
to
+119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Free Disk Space step check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Remove Trailing Spaces.
Line 67 contains extra trailing spaces. Cleaning these up will help with YAML linting.
Proposed diff:
📝 Committable suggestion
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 67-67: trailing spaces
(trailing-spaces)