Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature-request]: dynamically generate ENVs for build version, buildId and build time #435

Open
Clumsy-Coder opened this issue Jul 12, 2024 · 0 comments
Assignees
Labels
ci/cd Issue/feature-request related to CI/CD enhancement New feature or request
Milestone

Comments

@Clumsy-Coder
Copy link
Owner

Is your feature related to a problem?

I'd be nice to dynamically generate envs NEXT_PUBLIC_BUILD_VERSION, NEXT_PUBLIC_BUILD_ID and NEXT_PUBLIC_BUILD_TIME at build time, instead of generating using the generateEnvs.sh script

Describe the new feature

  • dynamically generate ENVs at build time
  • remove generating the envs from the generateEnvs.sh

Additional context

check

@Clumsy-Coder Clumsy-Coder added enhancement New feature or request ci/cd Issue/feature-request related to CI/CD labels Jul 12, 2024
@Clumsy-Coder Clumsy-Coder added this to the Miscellaneous milestone Jul 12, 2024
@Clumsy-Coder Clumsy-Coder self-assigned this Jul 12, 2024
Clumsy-Coder added a commit that referenced this issue Jul 17, 2024
  ## what
  - add env for build version, build id and build time
    - get the env from terminal or obtained from running npm script
      - NEXT_PUBLIC_BUILD_VERSION: obtain from either
        - terminal env `NEXT_PUBLIC_BUILD_VERSION`
        - run npm script `npm run -s generateEnv`
      - NEXT_PUBLIC_BUILD_ID
        - terminal env `NEXT_PUBLIC_BUILD_ID`
        - run npm script `npm run -s generateBuildId`
      - NEXT_PUBLIC_BUILD_TIME
        - terminal env `NEXT_PUBLIC_BUILD_TIME`
        - run bash command `date +%s`

  ## how
  - it will check the env value is set in the terminal before running
    the `pnpm run dev` or `pnpm run build` command. If the value is NOT
    set in the terminal then obtain it by running the npm script
  - setting the env in `env` property
  - check
    - https://nextjs.org/docs/app/api-reference/next-config-js/env

  ## why
  - this is to set the env in the config file instead of generating the
    values and placing them in `.env.local` file; removes the need for
    using `generateEnvs.sh` script

  ## where
  - ./next.config.js

  ## usage
  - run `pnpm run dev` or `pnpm run build`

  ## issue or pull request
  - #435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/cd Issue/feature-request related to CI/CD enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant