From bf04901d92e2909464f393d310d0fe70be5f053d Mon Sep 17 00:00:00 2001
From: Brandon Clayton <bclayton@usgs.gov>
Date: Wed, 4 May 2022 16:29:33 -0600
Subject: [PATCH] add pipeline

---
 .gitlab-ci.yml | 41 +++++++++++++++++++++++++++++------------
 1 file changed, 29 insertions(+), 12 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 575787d..7fd4d8e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,12 +2,22 @@ variables:
   GITLAB_TOKEN: '${CI_JOB_TOKEN}'
   NODE_IMAGE_NAME: ${CODE_REGISTRY_IMAGE}/${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG}--node
 
+# Do not run for merge requests
+workflow:
+  rules:
+    - if: $CI_COMMIT_TAG
+    - if: $CI_COMMIT_BRANCH
+
 stages:
   - init
   - node-image
   - build
   - publish
 
+default:
+  tags:
+    - nshmp
+
 ####
 # Stage: init
 ####
@@ -50,27 +60,31 @@ Build Node Image:
 # Stage: Build
 ####
 
-.node:
+Audit:
+  allow_failure: true
+  extends:
+    - .node
+  needs: []
+  script:
+    - npm audit
+
+Build Angular:
   image: ${DEVOPS_REGISTRY}usgs/node:16
   needs:
     - Init
-  stage: build
-  tags:
-    - development
-
-Build Angular:
-  extends:
-    - .node
   script:
     - cd example
     - npm i
     - npm run build
+  stage: build
 
 Lint Project:
-  extends:
-    - .node
+  image: ${DEVOPS_REGISTRY}usgs/node:16
+  needs:
+    - Init
   script:
     - npm run lint
+  stage: build
 
 ####
 # Stage: Publish
@@ -80,6 +94,11 @@ Publish npm:
   image: ${NODE_IMAGE_NAME}
   only:
     - tags
+  needs:
+    - Audit
+    - Init
+    - Build Angular
+    - Lint Project
   script:
     - git config user.email "${GITLAB_USER_EMAIL}"
     - git config user.name "${GITLAB_USER_NAME}"
@@ -91,5 +110,3 @@ Publish npm:
     - npx standard-version --release-as ${CI_COMMIT_TAG} --skip.commit --skip.changelog
     - npm publish --access public
   stage: publish
-  tags:
-    - development
-- 
GitLab