stages: - setup - install - build - publish # Prepare the environment setup: stage: setup image: php:8.2 script: - apt update -yqq - apt install git libzip-dev zip make wget libonig-dev libcurl4-openssl-dev -yqq - docker-php-ext-install mbstring ctype posix zip curl fileinfo # Install Phive and Phpab install: stage: install script: - wget -O phive.phar https://phar.io/releases/phive.phar - wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc - chmod +x phive.phar - mv phive.phar /usr/local/bin/phive - phive install phpab --global # Build the project using the Makefile build: stage: build script: - make autoload - make redist - make tar artifacts: paths: - build/*.tar.gz # Publish the package publish: stage: publish script: - | if [[ ! -z "$CI_COMMIT_TAG" ]]; then # If this is a tagged commit, use the tag name as package name PACKAGE_NAME=$CI_COMMIT_TAG else # Otherwise, use the branch name as the package name PACKAGE_NAME=$CI_COMMIT_REF_NAME fi echo "Package Name: $PACKAGE_NAME" curl --header "JOB-TOKEN: $CI_JOB_TOKEN" \ --upload-file build/*.tar.gz \ "https://$CI_SERVER_HOST/api/v4/projects/$CI_PROJECT_ID/packages/generic/$PACKAGE_NAME/$CI_PIPELINE_ID/file.tar.gz" only: - branches - tags