79282350

Date: 2024-12-15 12:56:35
Score: 0.5
Natty:
Report link

I tried the proposed answer but it didn't work for me as I'm using nextjs and firebase. I had to modify the package.json with a new script

"deploy-hosting-preprod": "sed -i '.bak' 's/NEXT_PUBLIC_ENVIRONMENT=.*/NEXT_PUBLIC_ENVIRONMENT=live/' .env; export NEXT_PUBLIC_ENVIRONMENT=live; firebase deploy --only hosting:preprod"

Also in my firebase json instead of using predeploy I use postdeploy, to return the .env file to normal as:

{
  "hosting": [
    ...
    {
      "target": "preprod",
      "source": ".",
      "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
      "postdeploy": ["npm run revert-env"]
    }
  ],
  ...
Reasons:
  • Blacklisted phrase (1): it didn't work for me
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: SAGB