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

chore: Updated GitHub Workflow for RC Versioning #133

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Conversation

seeratawan01
Copy link
Member

@seeratawan01 seeratawan01 commented Oct 23, 2024

PR Type

enhancement


Description

  • Enhanced the GitHub Actions workflow to improve the release candidate (RC) versioning process.
  • Renamed the dev_publish job to build and added outputs for RC version management.
  • Added new jobs for publishing SDK, NextJS, and React packages to npm with RC tags.
  • Implemented steps for building and pushing Docker images to the GitHub Container Registry.
  • Updated Kubernetes manifests to use the latest Docker image version.

Changes walkthrough 📝

Relevant files
Enhancement
cd-develop.yml
Enhance GitHub Workflow for RC Versioning and Deployment 

.github/workflows/cd-develop.yml

  • Renamed job dev_publish to build and added outputs for RC version.
  • Added steps for setting up Node.js, installing dependencies, and
    generating RC version.
  • Introduced new jobs for publishing SDK, NextJS, and React packages.
  • Added steps for building and pushing Docker images and updating
    Kubernetes manifests.
  • +165/-98

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @seeratawan01 seeratawan01 merged commit 301b91b into develop Oct 23, 2024
    1 of 2 checks passed
    @github-actions github-actions bot added the enhancement New feature or request label Oct 23, 2024
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🏅 Score: 85
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Possible Bug
    The RC version generation logic might not handle pre-existing RC tags correctly, potentially leading to incorrect version increments.

    Performance Issue
    The current setup for building and pushing Docker images might be inefficient due to the lack of caching mechanisms, which could slow down the CI process.

    Code feedback:
    relevant file.github/workflows/cd-develop.yml
    suggestion      

    Consider adding error handling for the RC version generation step to ensure the process does not fail silently. [important]

    relevant linerun: |

    relevant file.github/workflows/cd-develop.yml
    suggestion      

    It's recommended to use a more specific node version rather than a broad major version to ensure consistent builds across environments. [medium]

    relevant linenode-version: '20'

    relevant file.github/workflows/cd-develop.yml
    suggestion      

    To improve the security and maintainability of the workflow, consider using a more restrictive set of permissions for jobs that do not need broad access. [important]

    relevant linepermissions:

    relevant file.github/workflows/cd-develop.yml
    suggestion      

    To avoid potential race conditions between package publications, consider adding explicit dependencies or checks before proceeding to subsequent publish steps. [important]

    relevant lineneeds: publish-sdk

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Ensure the directory exists before attempting operations within it

    Verify the existence of the directory before attempting to change into it and
    publish, to prevent build failures.

    .github/workflows/cd-develop.yml [109-110]

     run: |
    -  cd packages/javascript-sdk
    -  pnpm publish --no-git-checks --tag rc --access public
    +  if [ -d "packages/javascript-sdk" ]; then
    +    cd packages/javascript-sdk
    +    pnpm publish --no-git-checks --tag rc --access public
    +  else
    +    echo "Directory not found"
    +  fi
    Suggestion importance[1-10]: 8

    Why: Verifying the existence of the directory before changing into it prevents potential build failures. This is a crucial check that can prevent the workflow from failing unexpectedly if the directory is missing.

    8
    Enhancement
    Add the registry URL to the node setup to ensure npm uses the correct registry

    Ensure that the registry-url is set in the actions/setup-node@v4 step to configure
    npm to use the specified registry.

    .github/workflows/cd-develop.yml [89-92]

     - name: Setup Node.js
       uses: actions/setup-node@v4
       with:
         node-version: '20'
    +    registry-url: 'https://registry.npmjs.org'
    Suggestion importance[1-10]: 7

    Why: This suggestion ensures that the npm registry URL is explicitly set, which can prevent potential issues with package installations. It is a good practice to specify the registry, especially in CI/CD environments, to avoid unexpected behavior.

    7
    Best practice
    Use a more specific tag for npm packages to enhance version management

    Use a more specific tag than rc for the npm packages to avoid conflicts and ensure
    clarity in package management.

    .github/workflows/cd-develop.yml [110]

    -pnpm publish --no-git-checks --tag rc --access public
    +pnpm publish --no-git-checks --tag rc-${{ github.run_number }} --access public
    Suggestion importance[1-10]: 7

    Why: Using a more specific tag for npm packages, such as including the GitHub run number, helps avoid conflicts and provides better clarity in package management. This is a best practice for managing package versions in a CI/CD pipeline.

    7
    Implement error handling for the publish command to enhance robustness

    Add error handling for the pnpm publish command to manage failures gracefully.

    .github/workflows/cd-develop.yml [109-110]

     run: |
       cd packages/javascript-sdk
    -  pnpm publish --no-git-checks --tag rc --access public
    +  pnpm publish --no-git-checks --tag rc --access public || echo "Publish failed"
    Suggestion importance[1-10]: 6

    Why: Adding error handling for the pnpm publish command improves the robustness of the workflow by providing feedback if the publish step fails. This can help in diagnosing issues during the CI/CD process.

    6

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    enhancement New feature or request
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant