-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
75 lines (67 loc) · 2.26 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
75 lines (67 loc) · 2.26 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
74
75
image: node:16
before_script:
- apt-get update
- apt-get install zip
cache:
paths:
- node_modules/
stages:
- init
- build
- deploy
############### BETA ################
# TODO: Automatic beta builds are disabled in favor of tagged releases.
# init-beta:
# stage: init
# image: docker:latest
# variables:
# VAR_NAME: BETA_BUILD_NUMBER
# TOKEN: ${CI_PIPELINE_IID_TOKEN}
# GITLAB_URL: "https://gitlab.com"
# before_script:
# - apk add --update curl jq
# script:
# - "VAR=$(curl -s -f --header \"PRIVATE-TOKEN: ${TOKEN}\" \"${GITLAB_URL}/api/v4/projects/${CI_PROJECT_ID}/variables/${VAR_NAME}\" | jq -r '.value' ) "
# - let VAR=VAR+1
# - "curl -s -f --request PUT --header \"PRIVATE-TOKEN: ${TOKEN}\" \"${GITLAB_URL}/api/v4/projects/${CI_PROJECT_ID}/variables/${VAR_NAME}\" --form \"value=${VAR}\" "
# only:
# - beta
build-prod:
stage: build
script:
- export
- npm ci
- npm run build
- node update-build-tags.js --branch=$CI_COMMIT_BRANCH --gitlabpath=$CI_PROJECT_PATH --jobname=$CI_JOB_NAME --tag=$CI_COMMIT_TAG --bucket=$S3_BUCKET
- cp ./dist/system.json ./system.json
- mv dist pbta
- zip -q pbta.zip -r pbta
artifacts:
paths:
- pbta.zip
- system.json
only:
# Examples: 0.1.0, 0.1.2.beta-1, 0.3.4.alpha
# At least one digit + period, followed by additional digits, followed by an optional beta/alpha, followed by a build number.
- /^(\d+\.)+(\d+)*((beta|alpha)+(-)*\d+)*$/i
except:
- branches
deploy-beta:
stage: deploy
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
dependencies:
- build-prod
script:
- BRANCH=$(./get-version.sh)
- aws configure set region us-east-1
# Write the tagged artifact and manifest.
- aws s3 cp ./pbta.zip s3://$S3_BUCKET/pbta/$CI_COMMIT_TAG/pbta.zip --acl="public-read"
- aws s3 cp ./system.json s3://$S3_BUCKET/pbta/$CI_COMMIT_TAG/system.json --acl="public-read"
# Write the general beta/alpha manifest.
- aws s3 cp ./system.json s3://$S3_BUCKET/pbta/$BRANCH/system.json --acl="public-read"
only:
# Examples: 0.1.0, 0.1.2.beta-1, 0.3.4.alpha
# Unlike the build script, this _only_ runs on beta/alpha tags.
- /^(\d+\.)+(\d+)*((beta|alpha)+(([-.v])*\d+)+)*$/i
except:
- branches