.gitlab-ci.yml.bak

stages:
    - build
    - release

variables:
  # Package version can only contain numbers (0-9), and dots (.).
  # Must be in the format of X.Y.Z, i.e. should match /\A\d+\.\d+\.\d+\z/ regular expresion.
  # See https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-package-file
  PACKAGE_VERSION: "0.8.${CI_PIPELINE_IID}"
    # PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/code-scrawl/${PACKAGE_VERSION}/scrawl.phar"
  PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/files/scrawl-${PACKAGE_VERSION}.phar"

build:
    stage: build
    image: php:8.2
    script:
      - echo "Creating scrawl.phar"
      - apt-get update -yqq
      - apt-get install -yqq git libzip-dev
      - docker-php-ext-install zip
      # Install PHP extensions
      # Install & enable Xdebug for code coverage reports
      # Install and run Composer
      - curl -sS https://getcomposer.org/installer | php
      - php composer.phar install --no-dev
      - bin/build-phar --build-phar
      - "curl --header 'JOB-TOKEN: ${CI_JOB_TOKEN}' --upload-file build/scrawl.phar ${PACKAGE_REGISTRY_URL}"
    artifacts:
        paths:
            - build/
release:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  script:
      - echo "Creating release"
  release:                                         # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
    tag_name: '$PACKAGE_VERSION'                # The version is incremented per pipeline.
    description: '$PACKAGE_VERSION'
    ref: '$CI_COMMIT_SHA'                          # The tag is created from the pipeline SHA.
    assets:
        links:
            - name: 'scrawl.phar'
              url: "${PACKAGE_REGISTRY_URL}"
              filepath: '/scrawl.phar'