Skip to content
Snippets Groups Projects
Commit 72caa430 authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

Merge branch 'pipeline-templates' into 'main'

Resolves - Pipeline Templates

Closes #3

See merge request !12
parents 0fc1d902 4d4c5ddc
No related branches found
No related tags found
1 merge request!12Resolves - Pipeline Templates
Pipeline #100134 passed
variables:
GITLAB_TOKEN: '${CI_JOB_TOKEN}'
NODE_IMAGE_NAME: ${CODE_REGISTRY_IMAGE}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG}
include:
- project: 'ghsc/hazdev/pipeline-build-template'
ref: '1.1.3'
file: 'templates/library.yml'
NODE_IMAGE_NAME: ${CODE_REGISTRY_IMAGE}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG}--node
stages:
- init
- node-image
- test
- build
- publish
# Do not run for merge requests
workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
####
# Template: GitLab runner tags
####
.dev-tags:
tags:
- development
####
# Template: Run Node
# Stage: init
####
.node:
image: ${NODE_IMAGE_NAME}
extends:
- .tags::development
before_script:
Init:
artifacts:
paths:
- node_modules
image: ${DEVOPS_REGISTRY}usgs/node:16
script:
- npm ci
stage: init
####
# Stage: Node Image
####
Build Node Image:
extends:
- .dind
- .tags::build
image: ${DEVOPS_REGISTRY}docker:19.03-git
needs: []
script:
- |
docker build \
--build-arg FROM_IMAGE=${DEVOPS_REGISTRY}usgs/node:latest \
--build-arg FROM_IMAGE=${DEVOPS_REGISTRY}usgs/node:16 \
--file "Dockerfile" \
--pull \
--tag ${NODE_IMAGE_NAME} \
.
- docker push ${NODE_IMAGE_NAME}
services:
- alias: docker
name: ${DEVOPS_REGISTRY}docker:19.03-dind
stage: node-image
tags:
- build
variables:
DOCKER_DRIVER: overlay2
####
# Stage: test
# Stage: Build
####
Build Angular:
.node:
image: ${DEVOPS_REGISTRY}usgs/node:16
needs:
- Build Node Image
stage: test
extends: .node
- Init
stage: build
tags:
- development
Build Angular:
extends:
- .node
script:
- cd example
- npm i
- npm run build
Lint:
needs:
- Build Node Image
stage: test
extends: .node
Lint Project:
extends:
- .node
script:
- npm run tslint
- npm run lint
####
# Stage: publish
# Stage: Publish
####
Publish npm:
needs:
- Build Node Image
stage: publish
image: ${NODE_IMAGE_NAME}
extends: .dev-tags
only:
- tags@ghsc/nshmp/disagg-d3
before_script:
- echo '//code.usgs.gov/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}' >> .npmrc
- npm ci
- tags
script:
- git config user.email "${GITLAB_USER_EMAIL}"
- git config user.name "${GITLAB_USER_NAME}"
script:
- npm run build
- |
cat <<-EO_CONFIG > .npmrc
@${CI_PROJECT_ROOT_NAMESPACE}:registry=https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/
//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}
EO_CONFIG
- npx standard-version --release-as ${CI_COMMIT_TAG} --skip.commit --skip.changelog
- npm publish --access public
stage: publish
tags:
- development
......@@ -5,12 +5,12 @@
"main": "src/index.js",
"types": "types/index.d.ts",
"scripts": {
"start": "cd example && npm i && npm run start",
"fix": "npm run tslint -- --fix",
"lint": "tslint -c tslint.json 'types/**/*.d.ts' 'src/**/*.d.ts'",
"npm-cli-login": "npm-cli-login",
"pre-commit": "pretty-quick --staged && npm run tslint",
"pre-commit": "pretty-quick --staged && npm run lint",
"pre-push": "npm run pre-commit",
"tslint": "tslint -c tslint.json 'types/**/*.d.ts' 'src/**/*.d.ts'",
"tslint:fix": "npm run tslint -- --fix",
"start": "cd example && npm i && npm run start",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment