Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Angular
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
to be continuous...
Angular
Commits
304ee1b4
Commit
304ee1b4
authored
1 year ago
by
Pierre Smeyers
Browse files
Options
Downloads
Patches
Plain Diff
feat(publish): auto publish on release tag
parent
e928a970
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+6
-3
6 additions, 3 deletions
README.md
kicker.json
+2
-2
2 additions, 2 deletions
kicker.json
templates/gitlab-ci-angular.yml
+7
-5
7 additions, 5 deletions
templates/gitlab-ci-angular.yml
with
15 additions
and
10 deletions
README.md
+
6
−
3
View file @
304ee1b4
...
...
@@ -302,16 +302,19 @@ It is bound to the `test` stage, and uses the following variables:
### `ng-publish` job
Th
e Angular template features a
`ng-publish`
job to
publish the
built
project.
Th
is job
[
publishes
](
https://docs.npmjs.com/cli/v6/commands/npm-
publish
)
the project
packages to a npm registry
.
This job is bound to the
`publish`
stage, and uses the following variable:
This job is bound to the
`publish`
stage and is disabled by default.
When enabled, it is executed on a Git tag with a semantic version pattern (
`v?[0-9]+\.[0-9]+\.[0-9]+`
, _configurable_).
It uses the following variables:
| Name | description | default value |
|----------------------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|
|
`NG_PUBLISH_ENABLED`
| Set variable to
`true`
to enable the publish job | none (disabled) |
|
`NG_PUBLISH_PROJECTS`
| Space separated list of projects to publish | If no project is specified, all workspace projects are published |
|
`NG_PUBLISH_ARGS`
| NPM
[
publish
](
https://docs.npmjs.com/cli/v6/commands/npm-publish
)
arguments |
`--verbose`
|
|
`NPM_PUBLISH_REGISTRY`
|
NPM
registry to publish to | uses GitLab project npm packages registry | |
|
`NPM_PUBLISH_REGISTRY`
|
npm
registry to publish to | uses GitLab project npm packages registry | |
| :lock:
`NPM_PUBLISH_TOKEN`
| NPM publication registry authentication token | none |
:warning: When using the gitlab registry (which is the default behavior), your NPM package name must be in the format of
`@scope/package-name`
:
...
...
This diff is collapsed.
Click to expand it.
kicker.json
+
2
−
2
View file @
304ee1b4
...
...
@@ -62,7 +62,7 @@
{
"id"
:
"publish"
,
"name"
:
"Publish"
,
"description"
:
"
NPM
[publish](https://docs.npmjs.com/cli/v6/commands/npm-publish)
your angular project
"
,
"description"
:
"[publish
es
](https://docs.npmjs.com/cli/v6/commands/npm-publish)
the project packages to a npm registry
"
,
"enable_with"
:
"NG_PUBLISH_ENABLED"
,
"variables"
:
[
{
...
...
@@ -78,7 +78,7 @@
},
{
"name"
:
"NPM_PUBLISH_REGISTRY"
,
"description"
:
"
NPM
registry to publish to. If none is specified, uses GitLab project npm packages registry"
,
"description"
:
"
npm
registry to publish to. If none is specified, uses GitLab project npm packages registry"
,
"secret"
:
true
},
{
...
...
This diff is collapsed.
Click to expand it.
templates/gitlab-ci-angular.yml
+
7
−
5
View file @
304ee1b4
...
...
@@ -73,6 +73,8 @@ variables:
PROD_REF
:
'
/^(master|main)$/'
# default integration ref name (pattern)
INTEG_REF
:
'
/^develop$/'
# default release tag name (pattern)
RELEASE_REF
:
'
/^v?[0-9]+\.[0-9]+\.[0-9]+$/'
# ==================================================
# Variables for publication
...
...
@@ -346,7 +348,6 @@ stages:
npm config set "@${CI_PROJECT_ROOT_NAMESPACE}:registry" "https://${CI_SERVER_HOST}/api/v4/packages/npm/"
npm config set "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken" "${CI_JOB_TOKEN}"
fi
}
function npm_publish() {
...
...
@@ -414,7 +415,6 @@ stages:
log_info "Publishing project '${project}' from ${projectOutputDir}"
npm publish "${projectOutputDir}" "${NG_PUBLISH_ARGS}"
done
}
unscope_variables
...
...
@@ -576,6 +576,8 @@ ng-publish:
script
:
-
npm_publish
rules
:
# on production branche: manual
-
if
:
'
$NG_PUBLISH_ENABLED
==
"true"
&&
$CI_COMMIT_REF_NAME
=~
$PROD_REF'
when
:
manual
# exclude if $NG_PUBLISH_ENABLED not set
-
if
:
'
$NG_PUBLISH_ENABLED
!=
"true"'
when
:
never
# on tag with release pattern: auto
-
if
:
'
$CI_COMMIT_TAG
=~
$RELEASE_REF'
This diff is collapsed.
Click to expand it.
Pierre-Alain RIVIERE
@pariviere
mentioned in commit
45bb11a7
·
1 year ago
mentioned in commit
45bb11a7
mentioned in commit 45bb11a757db3f0c8f224640d2d31b9318d3e520
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment