-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
73 lines (69 loc) · 1.99 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
73 lines (69 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
include:
- project: 'muensmedia-docker/gitlab-ci-recipes'
file:
- '/package_manager/.composer.yml'
stages:
- test
- deploy
pint:
stage: test
extends:
- .composer-install
variables:
PHP_VERSION: '8.5'
FOLDER_TO_RUN_COMPOSER: './'
COMPOSER_FOLDER: './vendor/'
COMPOSER_PARAMETERS: '--optimize-autoloader --no-interaction'
cache:
key: ${CI_COMMIT_REF_SLUG}-85
paths:
- ${COMPOSER_FOLDER}
only:
- main
- merge_requests
script:
- !reference [.composer-install, script]
- ./vendor/bin/pint --test
unit tests php8.5:
stage: test
extends:
- .composer-install
variables:
PHP_VERSION: '8.5'
FOLDER_TO_RUN_COMPOSER: './'
COMPOSER_FOLDER: './vendor/'
COMPOSER_PARAMETERS: '--optimize-autoloader --no-interaction'
cache:
key: ${CI_COMMIT_REF_SLUG}-85
paths:
- ${COMPOSER_FOLDER}
script:
- !reference [.composer-install, script]
- ./vendor/bin/pest --compact --profile
artifacts:
paths:
- build/report.junit.xml
reports:
junit: build/report.junit.xml
# Publish a tag (version) or branch to Composer Packages of the current project
publish:
stage: deploy
image: curlimages/curl:latest
variables:
URL: "$CI_SERVER_PROTOCOL://$CI_SERVER_HOST:$CI_SERVER_PORT/api/v4/projects/$CI_PROJECT_ID/packages/composer?job_token=$CI_JOB_TOKEN"
needs:
- unit tests php8.5
script:
- version=$([[ -z "$CI_COMMIT_TAG" ]] && echo "branch=$CI_COMMIT_REF_NAME" || echo "tag=$CI_COMMIT_TAG")
- 'echo "Deploying package version: $version"'
- insecure=$([ "$CI_SERVER_PROTOCOL" = "http" ] && echo "--insecure" || echo "")
- response=$(curl -s -w "\n%{http_code}" $insecure --data $version $URL)
- code=$(echo "$response" | tail -n 1)
- body=$(echo "$response" | head -n 1)
# Output state information
- if [ $code -eq 201 ]; then
echo "Package created - Code $code - $body";
else
echo "Could not create package - Code $code - $body";
exit 1;
fi