name: simulate-deployment
on:
  push:
    branches: ['feature/update-deploy']

  workflow_dispatch:

jobs:
  deploy-to-sb2:
    runs-on: ubuntu-latest

    env:
      SB2_ACCOUNT_ID: <account_id>
      SB2_TOKEN_ID: ${{ secrets.SB2_TOKEN_ID }}
      SB2_TOKEN_SECRET: ${{ secrets.SB2_TOKEN_SECRET }}

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1

      # Install the SuiteCloud CLI
      - run: npm install -g @oracle/suitecloud-cli

      # Install our dependencies
      - run: npm install

      # Run all tests
      - run: npm test

      # Get a token to use for deployment
      - run: npm run netsuite:savetoken

      # Add any missing dependencies for the current deployment
      - run: npm run netsuite:adddependencies

      # deploy
      - run: npm run netsuite:deploy
