-
Notifications
You must be signed in to change notification settings - Fork 370
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?
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
WalkthroughThis update introduces a unified way to set up environment variables by adding a new shared action. The workflows across several projects now call the shared action instead of using inline dotenv steps. In addition, some workflows add new steps for tasks like disk clean-up, artifact uploads, and test reporting. The overall approach streamlines the configuration and reduces redundancy across the CI/CD pipelines. Changes
Sequence Diagram(s)sequenceDiagram
participant R as Runner
participant C as Checkout
participant S as Shared Env Setup
participant B as Build/Deploy
participant A as Artifact Upload
R->>C: Trigger workflow and checkout code
C->>S: Initiate shared environment setup
S->>B: Inject environment variables
B->>A: Execute build and upload artifacts
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
(cherry picked from commit f1a887e)
77dba94
to
f63cfd0
Compare
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.
Actionable comments posted: 28
🔭 Outside diff range comments (1)
.github/workflows/release-ext.yml (1)
39-47
: Check the 'Setup ENV' step.
Extracting the package version and setting up the ARTIFACTS_URL works well. No changes are needed aside from ensuring no trailing whitespace remains.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (13)
.github/actions/shared-env/action.yml
(1 hunks).github/workflows/daily-build-dev.yml
(1 hunks).github/workflows/release-android-debug.yml
(4 hunks).github/workflows/release-android.yml
(4 hunks).github/workflows/release-desktop-mas.yml
(1 hunks).github/workflows/release-desktop-snap.yml
(2 hunks).github/workflows/release-desktop-winms.yml
(1 hunks).github/workflows/release-desktop.yml
(1 hunks).github/workflows/release-ext.yml
(1 hunks).github/workflows/release-ios-debug.yml
(2 hunks).github/workflows/release-ios.yml
(3 hunks).github/workflows/release-web.yml
(1 hunks).github/workflows/unittest.yml
(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/release-desktop-snap.yml
[error] 12-12: trailing spaces
(trailing-spaces)
[error] 25-25: trailing spaces
(trailing-spaces)
[error] 26-26: trailing spaces
(trailing-spaces)
.github/workflows/daily-build-dev.yml
[warning] 3-3: truthy value should be one of [false, true]
(truthy)
[error] 22-22: trailing spaces
(trailing-spaces)
[error] 31-31: trailing spaces
(trailing-spaces)
[error] 38-38: trailing spaces
(trailing-spaces)
[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)
.github/workflows/release-ios-debug.yml
[error] 26-26: trailing spaces
(trailing-spaces)
.github/workflows/unittest.yml
[error] 73-73: too many blank lines
(1 > 0) (empty-lines)
.github/workflows/release-desktop-winms.yml
[error] 25-25: trailing spaces
(trailing-spaces)
.github/workflows/release-ios.yml
[error] 26-26: trailing spaces
(trailing-spaces)
.github/workflows/release-ext.yml
[error] 24-24: trailing spaces
(trailing-spaces)
[error] 25-25: trailing spaces
(trailing-spaces)
.github/workflows/release-desktop.yml
[error] 25-25: trailing spaces
(trailing-spaces)
.github/workflows/release-web.yml
[error] 25-25: trailing spaces
(trailing-spaces)
.github/workflows/release-android.yml
[error] 16-16: trailing spaces
(trailing-spaces)
[error] 25-25: trailing spaces
(trailing-spaces)
[error] 26-26: trailing spaces
(trailing-spaces)
[error] 94-94: trailing spaces
(trailing-spaces)
[error] 117-117: too many blank lines
(1 > 0) (empty-lines)
.github/workflows/release-android-debug.yml
[error] 22-22: trailing spaces
(trailing-spaces)
[error] 28-28: trailing spaces
(trailing-spaces)
.github/workflows/release-desktop-mas.yml
[error] 25-25: trailing spaces
(trailing-spaces)
.github/actions/shared-env/action.yml
[error] 67-67: trailing spaces
(trailing-spaces)
[error] 91-91: trailing spaces
(trailing-spaces)
[error] 181-181: trailing spaces
(trailing-spaces)
[error] 204-204: too many blank lines
(2 > 0) (empty-lines)
🪛 actionlint (1.7.4)
.github/workflows/release-ios.yml
22-22: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
.github/workflows/release-web.yml
21-21: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
.github/workflows/release-android.yml
22-22: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
.github/workflows/release-android-debug.yml
24-24: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: lint (20.x)
- GitHub Check: unittest (20.x)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (20)
.github/workflows/release-web.yml (1)
20-24
: 🧹 Nitpick (assertive)Update Checkout Action Version
The "Checkout Source Code" step uses actions/checkout@v3. Consider checking if a newer version (for example, v4 if available) can offer enhanced performance and security.- uses: actions/checkout@v3 + uses: actions/checkout@v4🧰 Tools
🪛 actionlint (1.7.4)
21-21: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
.github/workflows/daily-build-dev.yml (1)
15-24
: 🧹 Nitpick (assertive)Inspect the 'Setup ENV' step.
You compute a dynamic build number but then override it with a static value. Verify that this behavior is intentional. Also, please remove any trailing spaces from these lines.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 22-22: trailing spaces
(trailing-spaces)
.github/workflows/release-android-debug.yml (2)
76-84
: Build APK step review.
The build commands look good and should generate the required artifacts. Confirm that the directory structure remains correct after the build.
23-27
: 🧹 Nitpick (assertive)Review the Checkout step.
The checkout action (actions/checkout@v3) is used here. While it works, verify if an upgrade to a newer version is preferred based on your CI requirements.🧰 Tools
🪛 actionlint (1.7.4)
24-24: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
.github/workflows/release-android.yml (3)
67-67
: Updated build.gradle Parameters
The versionName parameter now uses env.BUILD_APP_VERSION. Ensure that this environment variable is always set correctly upstream.
21-25
: 🧹 Nitpick (assertive)Update Checkout Action Version
The checkout step still uses actions/checkout@v3. Consider upgrading to a more recent version for improved stability and performance.🧰 Tools
🪛 actionlint (1.7.4)
22-22: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🪛 YAMLlint (1.35.1)
[error] 25-25: trailing spaces
(trailing-spaces)
87-94
: 🧹 Nitpick (assertive)Add WebEmbed Build Step
A new “Build WebEmbed” step is added. The environment variables and command look appropriate. Please double-check that NODE_OPTIONS and SENTRY_DISABLE_AUTO_UPLOAD meet your requirements. Also, remove any trailing spaces.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 94-94: trailing spaces
(trailing-spaces)
.github/workflows/release-ios.yml (1)
71-77
: Update plist Modification for OneKeyWallet
The Modify OneKeyWallet info.plist step now uses env.BUILD_APP_VERSION correctly. Ensure that the buildNumber and versionName align with your external build configuration..github/workflows/release-desktop-snap.yml (1)
44-52
: Setup ENV and Package Version Extraction
The "Setup ENV" step correctly extracts the package version and sets PKG_VERSION and ARTIFACTS_URL. The logic is clear and concise..github/workflows/release-desktop-winms.yml (1)
41-49
: Setup ENV Consistency
The code extracts the package version and sets PKG_VERSION and ARTIFACTS_URL. Everything appears correct, so please verify the artifact URL if needed..github/workflows/release-desktop.yml (2)
40-48
: Simplified ENV Extraction
The "Setup ENV" step now extracts the package version and sets necessary environment variables without redundant steps. This improves clarity.
149-161
: Slack Notification Update
The Slack notification step passes artifact metadata. Confirm that artifact-version-name and artifact-version-code correctly reference env.BUILD_NUMBER. Consider checking if the dependency (steps.dotenv.outputs.version) is still valid after migrating to shared env setup.🧰 Tools
🪛 actionlint (1.7.4)
158-158: property "dotenv" is not defined in object type {yarn-cache: {conclusion: string; outcome: string; outputs: {string => string}}; yarn-cache-dir-path: {conclusion: string; outcome: string; outputs: {string => string}}}
(expression)
.github/workflows/release-desktop-mas.yml (1)
39-46
: Retain Environment Setup for Additional Values.
The subsequent “Setup ENV” step (lines 39–46) still calculates the package version and artifact URL. Verify that this step complements the shared env action and does not create conflicts..github/actions/shared-env/action.yml (7)
1-3
: Action Metadata Clarity.
The metadata (name and description) is concise and clearly expresses the purpose of this composite action.
4-50
: Comprehensive Input Definitions.
The inputs are well defined with clear types, requirements, and descriptions. This setup covers all the necessary keys (e.g., Sentry, Covalent, RevenueCat) to standardize environment injection across workflows. Consider including examples in the descriptions if needed in the future.
55-66
: Checkout and Parameter Download Steps.
The steps to check out the source and download workflow parameters (lines 55–66) are implemented cleanly. The use of a conditional to trigger parameter download when a workflow run exists is effective.
85-90
: Dotenv Action Integration.
Loading the “.env.version” file using the Dotenv Action is a neat solution. Ensure that the file is maintained properly so that the version output remains accurate.
91-108
: Setting Up App Version and GitHub Tag.
The “Setup ENV” step processes the app version and converts the GitHub reference into a tag-friendly format. This string manipulation is pragmatic. Double-check that the replacement patterns match all possible ref formats.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 91-91: trailing spaces
(trailing-spaces)
112-122
: Fallback Build Number Assignment.
When the workflow wasn’t triggered by a run event, setting BUILD_NUMBER to “1” is a simple and clear fallback.
147-182
: Injecting Environment Variables.
This step consolidates multiple environment variables into the target env file. It covers all necessary keys, and the optional injection of additional variables is a flexible touch. Be sure that printing or logging these values does not inadvertently expose sensitive data.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 181-181: trailing spaces
(trailing-spaces)
- 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 | ||
|
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)
Review the 'Save workflow parameters' step.
The parameters are stored as expected. Remember to remove any trailing spaces in these lines to comply with YAML lint rules.
🧰 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 |
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)
Examine the 'Upload workflow parameters' step.
The artifact upload configuration is correct. Please clean up any trailing whitespace present in these lines.
|
||
|
||
|
||
|
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)
End-of-file cleanup.
A newline is missing and trailing spaces exist. Adding a final newline will improve file consistency.
🧰 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)
- name: Upload Test Report | ||
uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: test-report | ||
path: test-report.html | ||
|
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)
New 'Upload Test Report' step added.
The step is correctly configured to run always. However, there are extra blank lines that trigger YAML lint warnings; please remove them for better readability.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 73-73: too many blank lines
(1 > 0) (empty-lines)
- 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 "--------------------------------" | ||
|
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)
Print ENV File Content for Debugging.
Printing the contents of the .env files is useful for debugging. Just ensure that any sensitive information is masked or removed when in production logs.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Trim Trailing Spaces in Injection Block.
There are trailing spaces at the end of line 181. Removing these will improve formatting compliance.
Proposed diff:
- fi
+ fi
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
fi | |
fi |
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 181-181: trailing spaces
(trailing-spaces)
workflow: daily-build-dev | ||
name: workflow-params | ||
run_id: ${{ github.event.workflow_run.id }} | ||
|
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:
- lfs: true
+ lfs: true
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
lfs: true |
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 67-67: trailing spaces
(trailing-spaces)
with: | ||
path: .env.version | ||
|
||
- name: Setup ENV |
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)
Eliminate Unnecessary Spaces.
There are unwanted trailing spaces on line 91. Removing them will make the YAML cleaner.
Proposed diff:
- id: dotenv
+ id: dotenv
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 91-91: trailing spaces
(trailing-spaces)
fi | ||
echo "--------------------------------" | ||
|
||
|
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 Extra Blank Lines.
Line 204 shows too many blank lines at the end. Removing the extra lines will tidy up the file per YAML guidelines.
Proposed diff:
-
-
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
# (The two extra blank lines at the end are removed) |
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 204-204: too many blank lines
(2 > 0) (empty-lines)
- 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 "--------------------------------" | ||
|
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.
这里 cat .env
会把环境变量文件打印出来?有泄露风险么?
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.
问题不大,github secrets 里的会自动变成 ****,其他的本身也会在前端代码里暴露出来
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.
保险起见,这里先注释掉
(cherry picked from commit f1a887e)
Summary by CodeRabbit
This release refines our build and deployment workflows, ensuring faster and more reliable updates while enhancing testing feedback. Key improvements include: