Skip to content
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 release pathing #2606

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/build-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
description: 'Flag to show components typically only shown in development mode, for experimental or in-progress features.'
type: boolean
default: false
nested_deployments:
description: 'When true, the deployment will be nested in a sub-folder corresponding to the frontend_name. When false, the deployment will sit in the repo root folder, which means you can only have 1 deployment active at a time'
type: boolean
default: true

jobs:
build:
Expand Down Expand Up @@ -71,11 +75,15 @@ jobs:
run: yarn run nx run ${{inputs.frontend_name}}:build:production
- name: echos
run: |
echo ${{inputs.frontend_name}} > frontend_name
touch frontend_name
echo ${{inputs.deployment_name}} > deployment_name
echo ${{inputs.repo_name}} > repo_name
echo ${{inputs.repo_deploy_secret_name}} > repo_deploy_secret_name
echo $(git rev-parse HEAD) > ref
- name: echos (frontend_name)
if: inputs.nested_deployments == 'true'
run: |
echo ${{inputs.frontend_name}} > frontend_name
Comment on lines +78 to +86
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Refactor the frontend_name file handling.

Several issues with the current implementation:

  1. Creating an empty file then conditionally filling it is confusing
  2. Boolean comparison uses string 'true' instead of boolean true
  3. The empty frontend_name file is still uploaded as an artifact

Consider this alternative approach:

- touch frontend_name
  echo ${{inputs.deployment_name}} > deployment_name
  echo ${{inputs.repo_name}} > repo_name
  echo ${{inputs.repo_deploy_secret_name}} > repo_deploy_secret_name
  echo $(git rev-parse HEAD) > ref
- - name: echos (frontend_name)
-   if: inputs.nested_deployments == 'true'
-   run: |
-     echo ${{inputs.frontend_name}} > frontend_name
+ if [ "${{inputs.nested_deployments}}" = true ]; then
+   echo ${{inputs.frontend_name}} > frontend_name
+ else
+   echo "" > frontend_name
+ fi

This change:

  1. Consolidates the frontend_name file handling into a single step
  2. Uses proper boolean comparison
  3. Makes the empty file creation explicit when nested_deployments is false
📝 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.

Suggested change
touch frontend_name
echo ${{inputs.deployment_name}} > deployment_name
echo ${{inputs.repo_name}} > repo_name
echo ${{inputs.repo_deploy_secret_name}} > repo_deploy_secret_name
echo $(git rev-parse HEAD) > ref
- name: echos (frontend_name)
if: inputs.nested_deployments == 'true'
run: |
echo ${{inputs.frontend_name}} > frontend_name
- name: Create deployment files
run: |
echo ${{inputs.deployment_name}} > deployment_name
echo ${{inputs.repo_name}} > repo_name
echo ${{inputs.repo_deploy_secret_name}} > repo_deploy_secret_name
echo $(git rev-parse HEAD) > ref
if [[ "${{inputs.nested_deployments}}" == true ]]; then
echo "${{inputs.frontend_name}}" > frontend_name
else
echo "" > frontend_name
fi

- name: Archive build
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/new-zo-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ jobs:
repo_name: ${{ vars.ZO_REPO}}
repo_deploy_secret_name: 'ZO_REPO_SSH_KEY'
show_dev_components: false
nested_deployments: false
Loading