Updated .gitlab-ci.yml
This commit is contained in:
parent
eb061171a5
commit
770a99d8c5
1 changed files with 38 additions and 64 deletions
102
.gitlab-ci.yml
102
.gitlab-ci.yml
|
@ -1,72 +1,46 @@
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
variables:
|
||||||
|
PACKAGE_NAME: $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME
|
||||||
|
PACKAGE_PATH: $CI_PROJECT_DIR/build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
image: php:8.1
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
# Install some stuff that the image doesn't come with
|
|
||||||
- apt update -yqq
|
|
||||||
- apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
|
|
||||||
|
|
||||||
# Install phive
|
|
||||||
- wget -O phive.phar https://phar.io/releases/phive.phar
|
|
||||||
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
|
||||||
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
|
||||||
- gpg --verify phive.phar.asc phive.phar
|
|
||||||
- chmod +x phive.phar
|
|
||||||
- mv phive.phar /usr/local/bin/phive
|
|
||||||
|
|
||||||
# install phpab
|
|
||||||
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
|
|
||||||
script:
|
|
||||||
- make tar
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH
|
|
||||||
|
|
||||||
release:
|
|
||||||
image: php:8.1
|
image: php:8.1
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
# Install some stuff that the image doesn't come with
|
- apt update -yqq
|
||||||
- apt update -yqq
|
- apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
|
||||||
- apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
|
- wget -O phive.phar https://phar.io/releases/phive.phar
|
||||||
|
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
||||||
# Install phive
|
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
||||||
- wget -O phive.phar https://phar.io/releases/phive.phar
|
- gpg --verify phive.phar.asc phive.phar
|
||||||
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
- chmod +x phive.phar
|
||||||
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
- mv phive.phar /usr/local/bin/phive
|
||||||
- gpg --verify phive.phar.asc phive.phar
|
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
|
||||||
- chmod +x phive.phar
|
|
||||||
- mv phive.phar /usr/local/bin/phive
|
|
||||||
|
|
||||||
# install phpab
|
|
||||||
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
|
|
||||||
script:
|
script:
|
||||||
- make redist
|
- make tar
|
||||||
- mkdir ncc_$CI_COMMIT_TAG
|
- mkdir -p $PACKAGE_PATH
|
||||||
- cp -r build/src/* ncc_$CI_COMMIT_TAG/
|
- mv build/*.tar.gz $PACKAGE_PATH/$PACKAGE_NAME.tar.gz
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- ncc_$CI_COMMIT_TAG/
|
- $PACKAGE_PATH/$PACKAGE_NAME.tar.gz
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH
|
||||||
|
|
||||||
|
tag_release:
|
||||||
|
image: php:8.1
|
||||||
|
script:
|
||||||
|
- echo "Uploading the package under the new tag"
|
||||||
|
dependencies:
|
||||||
|
- build
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
|
release:
|
||||||
ncc-docker-build:
|
name: 'Release $CI_COMMIT_TAG'
|
||||||
image: docker:latest
|
tag_name: '$CI_COMMIT_TAG'
|
||||||
services:
|
description: 'Release $CI_COMMIT_TAG'
|
||||||
- docker:dind
|
assets:
|
||||||
before_script:
|
links:
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
- name: $PACKAGE_NAME.tar.gz
|
||||||
script:
|
url: $CI_PROJECT_URL/-/packages/$CI_PROJECT_ID/package_files/$PACKAGE_NAME.tar.gz
|
||||||
- |
|
|
||||||
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
|
||||||
tag=""
|
|
||||||
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
|
||||||
else
|
|
||||||
tag=":$CI_COMMIT_REF_SLUG"
|
|
||||||
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
|
||||||
fi
|
|
||||||
- docker build --no-cache --pull -t "$CI_REGISTRY_IMAGE${tag}" .
|
|
||||||
- docker push "$CI_REGISTRY_IMAGE${tag}"
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_BRANCH == 'dev'
|
|
||||||
exists:
|
|
||||||
- Dockerfile
|
|
Loading…
Add table
Reference in a new issue