'Gitlab API create a composer package with `composer.json` outside root directory
I'm trying to create a private composer package with .gitlab-ci.yml using gitlab API.
The problem is that my composer.json file is inside app directory and I'm getting composer.json not found error while running pipeline. Any ideas how can I fix it or there's no solution for that case ?
Structure of the project looks like this:
.
├── app/
│ └── composer.json
└── .gitlab-ci.yml
The .gitlab-ci.yml:
stages:
- deploy
deploy:
stage: deploy
script:
- apk add curl
- 'curl --header "Job-Token: $CI_JOB_TOKEN" --data tag=$CI_COMMIT_TAG "${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/composer"'
Solution 1:[1]
You can always change directory (cd) in your script:
stages:
- deploy
deploy:
stage: deploy
before_script:
- apk add curl
script:
- cd app
- 'curl --header "Job-Token: $CI_JOB_TOKEN" --data tag=$CI_COMMIT_TAG "${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/composer"'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Adam Marshall |
