keyshade-xyz / keyshade

Realtime secret and configuration management tool, with the best in class security and seamless integration support
https://keyshade.xyz
Mozilla Public License 2.0
196 stars 96 forks source link

feat(cli): Add release pipeline (#297) #407

Open Kiranchaudhary537 opened 2 months ago

Kiranchaudhary537 commented 2 months ago

User description

Description

Give a summary of the change that you have made

Fixes #297

Dependencies

Mention any dependencies/packages used

Future Improvements

Mention any improvements to be done in future related to any file/feature

Mentions

Mention and tag the people

Screenshots of relevant screens

Add screenshots of relevant screens

Developer's checklist

If changes are made in the code:

Documentation Update


PR Type

enhancement, configuration changes


Description


Changes walkthrough πŸ“

Relevant files
Configuration changes
deploy-cli.yml
Add GitHub Actions workflow for CLI deployment                     

.github/workflows/deploy-cli.yml
  • Added a new GitHub Actions workflow for deploying the CLI.
  • Configured the workflow to trigger on pushes and pull requests to the
    main branch.
  • Included steps for checking out the repository, setting up Node.js,
    installing dependencies, bumping the version, generating a changelog,
    and publishing to NPM.
  • +39/-0   

    πŸ’‘ PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    codiumai-pr-agent-free[bot] commented 2 months ago

    PR Reviewer Guide πŸ”

    ⏱️ Estimated effort to review: 2 πŸ”΅πŸ”΅βšͺβšͺβšͺ
    πŸ§ͺ No relevant tests
    πŸ”’ No security concerns identified
    ⚑ Key issues to review

    File Path Mismatch
    The trigger paths in the workflow file reference '.github/workflows/deploy-cli.yaml' instead of '.github/workflows/deploy-cli.yml', which is the actual file name. This mismatch could prevent the workflow from triggering correctly.
    codiumai-pr-agent-free[bot] commented 2 months ago

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Security
    Enhance security by using a scoped NPM token ___ **To enhance security, consider using a scoped NPM token instead of a generic one.
    This limits the permissions associated with the token, reducing the risk if it gets
    exposed. Update the environment variable to use a scoped token.** [.github/workflows/deploy-cli.yml [39]](https://github.com/keyshade-xyz/keyshade/pull/407/files#diff-8b861bd9d09e119c9e80afa2efc4bfd8ba130aed4b7b129deaf4b941701529b7R39-R39) ```diff -NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} +NODE_AUTH_TOKEN: ${{ secrets.NPM_SCOPED_TOKEN }} ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 10 Why: Using a scoped NPM token limits the permissions associated with the token, reducing security risks if the token gets exposed. This is a crucial security improvement.
    10
    Possible issue
    Improve the accuracy of branch reference checks in workflow conditions ___ **To avoid potential issues with the main branch reference, it's safer to use
    github.event.ref instead of github.ref in the conditional check for running
    deployment jobs. This ensures the condition accurately checks the reference of the
    branch that triggered the workflow.** [.github/workflows/deploy-cli.yml [16]](https://github.com/keyshade-xyz/keyshade/pull/407/files#diff-8b861bd9d09e119c9e80afa2efc4bfd8ba130aed4b7b129deaf4b941701529b7R16-R16) ```diff -if: github.ref == 'refs/heads/main' +if: github.event.ref == 'refs/heads/main' ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 9 Why: Using `github.event.ref` instead of `github.ref` ensures the condition accurately checks the reference of the branch that triggered the workflow, reducing potential issues with branch references. This is a crucial improvement for workflow accuracy.
    9
    Best practice
    βœ… Ensure consistent dependency management by specifying the pnpm version ___
    Suggestion Impact:The commit added a step to install pnpm using the pnpm/action-setup@v2 action and specified the pnpm version as 9.7.1, which aligns with the suggestion to specify the pnpm version. code diff: ```diff + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 9.7.1 ```
    ___ **It's recommended to specify the version of pnpm to use in the workflow to ensure
    consistent behavior across different runs. This can be achieved by adding a
    pnpm-version key under the with section in the step that installs dependencies.** [.github/workflows/deploy-cli.yml [28-29]](https://github.com/keyshade-xyz/keyshade/pull/407/files#diff-8b861bd9d09e119c9e80afa2efc4bfd8ba130aed4b7b129deaf4b941701529b7R28-R29) ```diff - name: Install dependencies - run: pnpm install + uses: pnpm/action-setup@v2 + with: + version: 6.14 ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 8 Why: Specifying the `pnpm` version ensures consistent behavior across different runs, which is a good practice for dependency management. This suggestion is valid and improves the reliability of the workflow.
    8
    Performance
    βœ… Speed up builds by caching Node.js dependencies ___
    Suggestion Impact:The commit added a step to cache Node.js dependencies using actions/cache, which aligns with the suggestion to speed up the build process. code diff: ```diff + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- ```
    ___ **Consider adding a step to cache Node.js dependencies to speed up the build process.
    This can be done using the actions/cache action to cache the node_modules directory
    based on a key that includes the hash of the package-lock.json or pnpm-lock.yaml
    file.** [.github/workflows/deploy-cli.yml [28-29]](https://github.com/keyshade-xyz/keyshade/pull/407/files#diff-8b861bd9d09e119c9e80afa2efc4bfd8ba130aed4b7b129deaf4b941701529b7R28-R29) ```diff +- name: Cache Node modules + uses: actions/cache@v2 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-node- - name: Install dependencies run: pnpm install ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 7 Why: Caching Node.js dependencies can significantly speed up the build process, improving performance. This suggestion is beneficial but not critical, hence a moderate score.
    7
    kriptonian1 commented 2 weeks ago

    @Kiranchaudhary537 what's the update man

    Kiranchaudhary537 commented 2 weeks ago

    The requested changes have been implemented, and comments have been refactored. Please let me know if anything is missing.

    rajdip-b commented 2 weeks ago

    There are a ton of conflicts @Kiranchaudhary537, could you please put up another PR? I believe you haven't made changes to many files.