[question] Environment variable "GITLAB_TOKEN" is required for GitLab releases
See original GitHub issueAs the title already says, I’m always getting
Environment variable “GITLAB_TOKEN” is required for GitLab releases
when executing npm run release
My package.json looks like this (reduced verison):
{
"name": "...",
"version": "...",
"description": "...",
"main": "app.js",
"scripts": {
"release": "release-it"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/.../... .git"
},
"author": "...",
"license": "...",
"bugs": {
"url": "https://gitlab.com/.../.../issues"
},
"homepage": "https://gitlab.com/.../...#readme",
"devDependencies": {
"release-it": "^13.5.1"
},
"release-it": {
"git": {
"tagName": "v${version}",
"requireCleanWorkingDir": false,
"requireUpstream": false,
"commitMessage": "Release v%s"
},
"gitlab": {
"release": true
},
"npm": {
"publish": false
}
},
"dependencies": {
"chart.js": "^2.9.3",
"electron": "^8.2.0",
"lowdb": "^1.0.0"
}
}
I’m running on Win 10 Pro, and I tried to set GITLAB_TOKEN
by entering get GITLAB_TOKEN = tokenHere
Edit:
get | findstr "GITLAB_TOKEN"
also returns my token which confuses me even more because it’s definetly set.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
GitLab CI/CD variables
Documentation for GitLab Community Edition, GitLab Enterprise Edition, Omnibus GitLab, and GitLab Runner.
Read more >Semantic release not accepting GITLAB_TOKEN on gitlab ...
So in the end the problem was that I had to add the created GITLAB_TOKEN access token in Settings > CI/CD > Variables....
Read more >Readme · Variables · Ci · Help · GitLab
When receiving a job from GitLab CI, the Runner prepares the build environment. It starts by setting a list of predefined variables (environment...
Read more >GitLab - Jenkins Plugins
The first is the Git configuration, where Jenkins clones your git repo. The GitLab Plugin will set some environment variables when GitLab ......
Read more >Configure Your GitLab CI Environment Variable
Setting an environment variable in GitLab CI occurs on a per-repository basis. This example demonstrates how to create a variable for your API...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Added a section about environment variables, including a good cross-os solution: https://github.com/release-it/release-it/blob/master/docs/environment-variables.md
Or just prefix your npm command with a token like:
That way it will only be set for the duration of the command which should be better from security standpoint.
(But this won’t work on Windows. I know there is some npm package that handles that cross-platform but I forgot the name of it)
EDIT: here it is https://www.npmjs.com/package/cross-env