forked from PayGreen/sylius-paygreen-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
46 lines (42 loc) · 1.41 KB
/
.gitlab-ci.yml
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
variables:
GIT_DEPTH: 1000
stages:
- test
- deploy
publish:
image: curlimages/curl:latest
stage: deploy
variables:
URL: "$CI_SERVER_PROTOCOL://$CI_SERVER_HOST:$CI_SERVER_PORT/api/v4/projects/$CI_PROJECT_ID/packages/composer?job_token=$CI_JOB_TOKEN"
script:
- version=$([[ -z "$CI_COMMIT_TAG" ]] && echo "branch=$CI_COMMIT_REF_NAME" || echo "tag=$CI_COMMIT_TAG")
- 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
only:
- develop
- tags
push-to-github:
image: alpine:3.6
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: manual
script:
- apk add --no-cache bash git openssh-client
- mkdir -p ~/.ssh
- cp $GITHUB_PUSH_SSH_PRIVATE_KEY ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan "github.com" >> ~/.ssh/known_hosts
- git push [email protected]:PayGreen/sylius-paygreen-plugin.git ${CI_COMMIT_SHA:-HEAD}:refs/heads/master --force --tags
include:
- template: Security/SAST.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml