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

Update pipeline

parent 0fc1d902
No related branches found
No related tags found
1 merge request!12Resolves - Pipeline Templates
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 \
--file "Dockerfile" \
--build-arg FROM_IMAGE=${DEVOPS_REGISTRY}usgs/node:16 \
--file ".gitlab/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:
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
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