This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| gitlab-ci-composer-publish [2020/06/21 09:06] – [Extended config] admin | gitlab-ci-composer-publish [2020/06/21 21:19] (current) – admin | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| <code yaml> | <code yaml> | ||
| - | stages: | + | # Publishes a tag/branch to Composer Packages of the current project |
| - | - publish | + | |
| publish: | publish: | ||
| - | | + | |
| - | stage: | + | stage: |
| - | variables: | + | variables: |
| - | URL: " | + | URL: " |
| - | script: | + | script: |
| - | - version=$([ -z " | + | - version=$([[ -z " |
| - | - response=$(curl -s -w " | + | - insecure=$([ " |
| - | - code=$(echo " | + | |
| - | - body=$(echo " | + | - code=$(echo " |
| - | # Output state information | + | - body=$(echo " |
| - | - if [ $code -eq 201 ]; | + | # Output state information |
| - | | + | - if [ $code -eq 201 ]; then |
| - | echo " | + | echo " |
| - | else | + | else |
| - | echo "Could not create package - Code $code - $body"; | + | echo "Could not create package - Code $code - $body"; |
| - | exit 1; | + | exit 1; |
| - | fi | + | fi |
| </ | </ | ||
| Line 36: | Line 34: | ||
| <code yaml> | <code yaml> | ||
| stages: | stages: | ||
| - | | + | |
| - | - publish | + | - build |
| test: | test: | ||
| - | | + | |
| - | stage: test | + | stage: test |
| - | script: | + | script: |
| - | - composer install | + | - composer install |
| - | - vendor/ | + | - vendor/ |
| - | artifacts: | + | artifacts: |
| - | paths: | + | paths: |
| - | - tests/ | + | - tests/ |
| - | expire_in: 1 weeks | + | expire_in: 1 weeks |
| + | # Publishes a tag/branch to Composer Packages of the current project | ||
| publish: | publish: | ||
| - | | + | |
| - | stage: | + | stage: |
| - | variables: | + | variables: |
| - | URL: " | + | URL: " |
| - | script: | + | script: |
| - | - version=$([ -z " | + | - version=$([[ -z " |
| - | - response=$(curl -s -w " | + | - insecure=$([ " |
| - | - code=$(echo " | + | |
| - | - body=$(echo " | + | - code=$(echo " |
| - | # Output state information | + | - body=$(echo " |
| - | - if [ $code -eq 201 ]; | + | # Output state information |
| - | | + | - if [ $code -eq 201 ]; then |
| - | echo " | + | echo " |
| - | else | + | else |
| - | echo "Could not create package - Code $code - $body"; | + | echo "Could not create package - Code $code - $body"; |
| - | exit 1; | + | exit 1; |
| - | fi | + | fi |
| </ | </ | ||