-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
64 lines (58 loc) · 1.69 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
stages:
- lint
- release
.rules_mrs_and_protected:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_REF_PROTECTED == "true"
- if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
.base_job: &base_job
image: registry.gitlab.com/thelabnyc/python:py313-node20
before_script:
- npm ci
variables:
NODE_ENV: development
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
lint:
<<: *base_job
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_REF_PROTECTED == "true"
- if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
stage: lint
needs: []
script:
- npm run build
- npm run check
- pip3 install pre-commit
- pre-commit run --all-files
cache:
paths:
- ${PRE_COMMIT_HOME}
.release_job: &release_job
rules:
- if: $CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"
stage: release
needs:
- lint
release:js:
<<: *base_job
<<: *release_job
script:
- echo "@thelabnyc:registry=https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" > .npmrc
- echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
- npm run build
- npm publish
release:gitlab:
<<: *release_job
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- echo 'noop'
release:
name: "Release $CI_COMMIT_TAG"
description: "Release $CI_COMMIT_TAG. Tagged by $GITLAB_USER_LOGIN"
tag_name: "$CI_COMMIT_TAG"
ref: "$CI_COMMIT_TAG"