Answer the question
In order to leave comments, you need to log in
How to pass variables from gitlab-ci.yml to React?
Hello! I have a typescript application on react.
I create custom variables during the build process on gitlab, using gitlab's predefined variable, including, then I need to transfer the result to React. Here is what I have written so far.
gitlab-ci.yml
build:
stage: build
only:
- develop
script: |
export BRANCH=$CI_COMMIT_BRANCH
export TIMESTAMP=$(date +%d%m%Y.%H%M)
npm run build --env.BRANCH=$BRANCH --env.BUILDTIME:$TIMESTAMP
new webpack.DefinePlugin({
'process.env.BRANCH': JSON.stringify(process.env.BRANCH),
'process.env.BUILD_TIME': JSON.stringify(process.env.BUILDTIME),
})
module.exports = env =>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question