diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-02 03:10:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-02 03:10:29 +0300 |
commit | bd06cdbc9110f94cd2053b866c0df38b1ff6d932 (patch) | |
tree | 46e31de6933d8067a12ae2b6c7faa9ad8ee03d64 /doc/user/packages/composer_repository | |
parent | 5b8f2c8a24237cc5b2e2ba365b79e6293b93e459 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/user/packages/composer_repository')
-rw-r--r-- | doc/user/packages/composer_repository/index.md | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/doc/user/packages/composer_repository/index.md b/doc/user/packages/composer_repository/index.md index 54e7c4e56be..2d974a6321f 100644 --- a/doc/user/packages/composer_repository/index.md +++ b/doc/user/packages/composer_repository/index.md @@ -79,16 +79,17 @@ git push origin v1.0.0 Now that the basics of our project is completed, we can publish the package. To publish the package, you need: -- A personal access token. You can generate a [personal access token](../../../user/profile/personal_access_tokens.md) with the scope set to `api` for repository authentication. - NOTE: **Note:** +- A personal access token or `CI_JOB_TOKEN`. - [Deploy tokens](./../../project/deploy_tokens/index.md) are not yet supported for use with Composer. + ([Deploy tokens](./../../project/deploy_tokens/index.md) are not yet supported for use with Composer.) - Your project ID which can be found on the home page of your project. To publish the package hosted on GitLab, make a `POST` request to the GitLab package API. A tool like `curl` can be used to make this request: +You can generate a [personal access token](../../../user/profile/personal_access_tokens.md) with the scope set to `api` for repository authentication. For example: + ```shell curl --data tag=<tag> 'https://__token__:<personal-access-token>@gitlab.com/api/v4/projects/<project_id>/packages/composer' ``` @@ -101,6 +102,21 @@ Where: If the above command succeeds, you now should be able to see the package under the **Packages & Registries** section of your project page. +### Publishing the package with CI/CD + +To work with Composer commands within [GitLab CI/CD](./../../../ci/README.md), you can +publish Composer packages by using `CI_JOB_TOKEN` in your `.gitlab-ci.yml` file: + +```yaml +stages: + - deploy + +deploy: + stage: deploy + script: + - 'curl --header "Job-Token: $CI_JOB_TOKEN" --data tag=<tag> "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/packages/composer"' +``` + ### Installing a package To install your package, you need: |