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

Implement dynamic version injection #206

Open
filippomc opened this issue Sep 25, 2020 · 0 comments
Open

Implement dynamic version injection #206

filippomc opened this issue Sep 25, 2020 · 0 comments
Labels
enhancement New feature or request PRIORITY: Medium

Comments

@filippomc
Copy link
Collaborator

filippomc commented Sep 25, 2020

Pure frontend strategy using env variables

Inside the Docker image:

RUN VERSION=$(grep version setup.py | sed 's/^.*version="//g' | sed 's/\",//g') &&\ 
    npm run build --env.VERSION=$VERSION --env.COMMIT=$COMMIT

Inside the webpack:

module.exports = function (env){
  if (env === undefined) {
    env = {}
  }
  if (!env.COMMIT) {
    env.COMMIT = 'x.x.x'
  }
  if (!env.VERSION) {
    env.VERSION = PACKAGE.version
  }
...

Then use the following to get version

const PRESENT_COMMIT = process.env.COMMIT;
const PRESENT_VERSION = process.env.VERSION;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PRIORITY: Medium
Projects
None yet
Development

No branches or pull requests

2 participants