This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gitlab-ci-composer-publish [2020/06/19 23:25] – created admin | gitlab-ci-composer-publish [2020/06/21 21:19] (current) – admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Gitlab Composer Packages publish using Runner ====== | ====== Gitlab Composer Packages publish using Runner ====== | ||
- | Token: Set variable '' | ||
===== Minimal config ===== | ===== Minimal config ===== | ||
+ | |||
+ | Works without any further modification | ||
<code yaml> | <code yaml> | ||
- | stages: | + | # Publishes a tag/branch to Composer Packages of the current project |
- | - publish | + | |
publish: | publish: | ||
- | | + | |
- | stage: | + | stage: |
- | script: | + | variables: |
- | - if [ -z " | + | |
- | then | + | |
- | export PACKAGE_VERSION=" | + | - version=$([[ -z " |
- | else | + | - insecure=$([ " |
- | export PACKAGE_VERSION=" | + | - response=$(curl -s -w "\n%{http_code}" $insecure --data $version |
- | fi | + | - code=$(echo "$response" |
- | | + | - body=$(echo |
- | | + | # Output state information |
- | echo " | + | - if [ $code -eq 201 ]; then |
- | else | + | echo " |
- | echo "Could not create package | + | else |
- | exit 1; | + | echo "Could not create package |
- | fi | + | exit 1; |
+ | fi | ||
</ | </ | ||
===== Extended config ===== | ===== Extended config ===== | ||
+ | |||
+ | Make sure to adjust '' | ||
<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: |
- | script: | + | variables: |
- | - if [ -z " | + | |
- | then | + | |
- | export PACKAGE_VERSION=" | + | - version=$([[ -z " |
- | else | + | - insecure=$([ " |
- | export PACKAGE_VERSION=" | + | - response=$(curl -s -w "\n%{http_code}" $insecure --data $version |
- | fi | + | - code=$(echo "$response" |
- | | + | - body=$(echo |
- | | + | # Output state information |
- | echo " | + | - if [ $code -eq 201 ]; then |
- | else | + | echo " |
- | echo "Could not create package | + | else |
- | exit 1; | + | echo "Could not create package |
- | fi | + | exit 1; |
+ | fi | ||
</ | </ | ||