-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
47 lines (44 loc) · 1.23 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
47
stages:
- build
- deploy
build:
image: node:18.13.0
stage: build
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
- if: '$CI_COMMIT_TAG =~ /release-.*/'
script:
- npm install
- npm run build
cache:
paths:
- node_modules/
artifacts:
paths:
- dist/
expire_in: 1 hour
dev:
stage: deploy
image: "edbizarro/gitlab-ci-pipeline-php:8.0"
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
before_script:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
script:
- rsync -avz -e "ssh -o StrictHostKeyChecking=no" --delete dist/* $SSH_CONNECTION_DEV
- ssh -o StrictHostKeyChecking=no "$SSH_CONNECTION" "$ADD_HTACCESS"
live:
stage: deploy
image: "edbizarro/gitlab-ci-pipeline-php:8.0"
rules:
- if: '$CI_COMMIT_TAG =~ /release-.*/'
before_script:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
script:
- rsync -avz -e "ssh -o StrictHostKeyChecking=no" --delete dist/* $SSH_CONNECTION_LIVE