User Tools

Site Tools


gitlab-ci-release

This is an old revision of the document!


Gitlab CI create release

.gitlab-ci.yml
variables:
  PHAR_FILE_NAME: "typo3-composer-installer.phar"
  PHAR_ARTIFACT_NAME: "typo3-composer-installer"

stages:
  - publish
  - release

create_version:
  image: zeroseven07/docker-surf:php74
  stage: publish
  only:
    - tags
  script:
    - composer install
    - php -d phar.readonly=off ./vendor/bin/phar-composer -vvv build
    - echo 'JOB_ARTIFACT_ID='$CI_JOB_ID > build.env
  artifacts:
    name: $PHAR_ARTIFACT_NAME
    paths:
      - $PHAR_FILE_NAME
      - build.env
    expire_in: 1000 year

release:
  image: curlimages/curl:latest
  stage: release
  dependencies: 
    - create_version
  only:
    - tags
  script:
    # Get variables saved as artifacts in `.phar` template
    - export $(xargs <build.env)
    - 'curl --request POST --header "PRIVATE-TOKEN: $GITLAB_PRIVATE_TOKEN"
      --data name="$PHAR_ARTIFACT_NAME-$CI_COMMIT_TAG.phar" 
      --data url="$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/jobs/$JOB_ARTIFACT_ID/artifacts/$PHAR_FILE_NAME" 
      $CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/releases/$CI_COMMIT_TAG/assets/links'
gitlab-ci-release.1598823691.txt.gz · Last modified: 2020/08/30 23:41 by admin