Executando verificação de segurança...
0

[EN] Automating NetSuite Deployments

Using YML, Suite CLI, and TypeScript

NetSuite is a powerful cloud-based ERP (Enterprise Resource Planning) platform that helps businesses manage their financials, operations, and customer relationships. As a developer working with NetSuite, you’ll likely encounter scenarios where you need to automate deployments to different environments like Sandbox, Release, and Production. In this article, we will explore how to achieve autonomous deployments in NetSuite using popular CI/CD tools like GitHub Actions or GitLab CI, along with YML configuration, Suite CLI, and TypeScript to compile the files.

Prerequisites: Before diving into the deployment automation process, ensure you have the following prerequisites set up:

  • A NetSuite developer account;
    
  • SuiteCloud SDK installed on your local machine (includes Suite CLI and JDK17);
    
  • TypeScript knowledge (optional but beneficial for compiling files);
    
  • YML knowledge to build an environment steps;
    

Automating Deployments with YML and GitHub Actions or GitLab CI: CI/CD tools like GitHub Actions and GitLab CI provide an excellent framework for automating software deployments. By utilizing the power of YML (YAML) configurations, you can define a set of actions and steps that will be executed automatically when a specific event occurs, such as a push to a specific branch. The following sections will guide you through the process of setting up autonomous deployments in NetSuite using these tools.

Step 1: Set Up Repository and Environment Variables Create a repository for your NetSuite project on GitHub or GitLab (or any). Define environment variables to store sensitive data like NetSuite credentials and tokens securely (don't forget the bundle). These variables can be accessed by the CI/CD pipeline during the deployment process.

Step 2: Configure YML File Create a YML file (e.g., .github/workflows/netsuite-deploy.yml for GitHub Actions) to define the deployment workflow. The YML file will specify the build steps, dependencies, and deployment configurations. Below is a basic example of a YML file for NetSuite deployment:

name: NetSuite Deployment

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Install Suite CLI
        run: npm install -g @oracle/suitecloud-cli
        run: npm install -g typescript

      - name: Deploy to Sandbox
        env:
          NS_ACCOUNT: ${{ secrets.SANDBOX_ACCOUNT }}
          NS_EMAIL: ${{ secrets.SANDBOX_EMAIL }}
          NS_PASSWORD: ${{ secrets.SANDBOX_PASSWORD }}
          NS_ROLEID: ${{ secrets.SANDBOX_ROLEID }}
          NS_APPID: ${{ secrets.SANDBOX_APPID }}
        run: |
          tsc
          suitecloud project:validate
          suitecloud project:deploy

This YML file defines a workflow that triggers on every push to the main branch. It deploys the NetSuite project to Sandbox, Release, and Production environments. The necessary environment variables for each environment are securely stored in GitHub secrets or GitLab CI/CD variables.

Note the TSC command will compile all scripts to default JS, based on AMD module.

Conclusion: Automating deployments in NetSuite using GitHub Actions or GitLab CI with YML, Suite CLI, and TypeScript provides significant benefits for developers and teams. With autonomous deployments to multiple environments like Sandbox, Release, and Production, you can streamline the development process and improve collaboration. Embracing CI/CD methodologies not only enhances productivity but also ensures that your NetSuite projects are delivered consistently and reliably.

Remember to handle sensitive data like NetSuite credentials with care and use CI/CD best practices to maintain a secure and efficient deployment process. Happy automating!

Helpful links:
https://www.npmjs.com/package/@oracle/suitecloud-cli

Carregando publicação patrocinada...