How to override JS file via YAML deployment

30 Views Asked by At

I face one issue and I don't know the solution for this. Normally I use microsoft/variable-substitution@v1 to overwrite parameters inside json file. But now I have one js file like below.

module.exports = {
  server: "",
  port: 1433,
  database: "",
  user: "",
  password: "",
  driver: 'msnodesqlv8',
  options: {
    trustedConnection: true,
    trustServerCertificate: true
  }
}

and I want to fill data from github secrets via YAML file to deploy aplication.Below code is for one step inside yaml file

- name: Database Connection Variable Substitution
        uses: microsoft/variable-substitution@v1
        with:
          files: './server/config/dbConnection.js'
        env:
          server: ${{ secrets.DB_SERVER }}
          database: ${{ secrets.DB_NAME }}
          user: ${{ secrets.DB_USERNAME }}
          password: ${{ secrets.DB_PASSWORD }}

but it doesn't work and I understood that we can use this library for only json and xml, Is there any way yo overwrite also js files?

Thanks in advance Kind Regards

0

There are 0 best solutions below