This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gitlab-ci-release [2020/08/30 21:41] – created admin | gitlab-ci-release [2020/08/30 22:51] (current) – admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Gitlab CI create release ====== | ====== Gitlab CI create release ====== | ||
+ | |||
+ | Example to create a PHP archive (phar) and link the generated artifact to the release if a **Release Note** is set. | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | **Required to create a private token and set as environment variable $GITLAB_PRIVATE_TOKEN** | ||
+ | |||
+ | Example: | ||
<code yaml .gitlab-ci.yml> | <code yaml .gitlab-ci.yml> | ||
Line 18: | Line 29: | ||
- composer install | - composer install | ||
- php -d phar.readonly=off ./ | - php -d phar.readonly=off ./ | ||
+ | # Save variable for later use | ||
- echo ' | - echo ' | ||
artifacts: | artifacts: | ||
Line 23: | Line 35: | ||
paths: | paths: | ||
- $PHAR_FILE_NAME | - $PHAR_FILE_NAME | ||
+ | # Add .env file to artifacts | ||
- build.env | - build.env | ||
expire_in: 1000 year | expire_in: 1000 year | ||
Line 31: | Line 44: | ||
dependencies: | dependencies: | ||
- create_version | - create_version | ||
+ | when: on_success | ||
only: | only: | ||
- tags | - tags | ||
Line 36: | Line 50: | ||
# Get variables saved as artifacts in `.phar` template | # Get variables saved as artifacts in `.phar` template | ||
- export $(xargs < | - export $(xargs < | ||
+ | # Create release if a ' | ||
- 'curl --request POST --header " | - 'curl --request POST --header " | ||
--data name=" | --data name=" | ||
--data url=" | --data url=" | ||
$CI_SERVER_URL/ | $CI_SERVER_URL/ | ||
- | |||
</ | </ |