ncc/.gitlab-ci.yml

60 lines
1.4 KiB
YAML
Raw Normal View History

2023-08-16 15:47:53 -04:00
image: php:8.2
stages:
- setup
- install
- build
- publish
2023-08-16 15:47:53 -04:00
before_script:
- apt update -yqq
2023-08-16 15:58:07 -04:00
- apt install -yqq git libzip-dev zip make wget gnupg2 libonig-dev libcurl4-openssl-dev
2023-08-16 15:47:53 -04:00
# Prepare the environment
setup:
stage: setup
2023-08-16 12:20:16 -04:00
script:
2023-08-16 15:17:48 -04:00
- docker-php-ext-install mbstring ctype posix zip curl fileinfo
2023-03-01 19:08:18 +00:00
# Install Phive and Phpab
install:
stage: install
script:
2023-08-16 12:22:30 -04:00
- 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
2023-08-16 15:52:36 -04:00
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
2023-08-16 12:22:30 -04:00
# Build the project using the Makefile
build:
stage: build
2023-03-01 19:08:18 +00:00
script:
- make autoload
2023-08-16 12:22:30 -04:00
- make redist
- make tar
2023-08-16 12:20:16 -04:00
artifacts:
paths:
- build/*.tar.gz
2023-08-16 12:20:16 -04:00
# Publish the package
publish:
stage: publish
2023-08-16 12:20:16 -04:00
script:
2023-08-16 12:22:30 -04:00
- |
2023-08-16 15:09:24 -04:00
if [[ ! -z "$CI_COMMIT_TAG" ]]; then
# If this is a tagged commit, use the tag name as package name
PACKAGE_NAME=$CI_COMMIT_TAG
2023-08-16 12:22:30 -04:00
else
2023-08-16 15:09:24 -04:00
# Otherwise, use the branch name as the package name
PACKAGE_NAME=$CI_COMMIT_REF_NAME
2023-08-16 12:22:30 -04:00
fi
2023-08-16 15:09:24 -04:00
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