Skip to content

Commit

Permalink
Release from Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
inbeom committed Aug 14, 2019
1 parent 9c84853 commit 3c49e6b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ WORKDIR /app
COPY . .
RUN npm run bootstrap
RUN npm run build

# release
FROM build AS release

ARG npm_token
ENV NPM_TOKEN=${npm_token}

RUN echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > .npmrc
RUN npm run publish -- --yes
38 changes: 24 additions & 14 deletions cloudbuild.release.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
steps:
- name: 'gcr.io/cloud-builders/npm'
args: ['ci']
- name: 'gcr.io/cloud-builders/npm'
args: ['run-script', 'build']
- name: 'gcr.io/cloud-builders/npm'
entrypoint: 'bash'
args:
- '-c'
- |
if [[ "${TAG_NAME}" =~ ^release-prod-v[0-9]+$ ]]; then
echo //registry.npmjs.org/:_authToken=$$NPM_TOKEN > .npmrc
npm publish
fi
secretEnv: ['NPM_TOKEN']
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
docker pull gcr.io/${PROJECT_ID}/${_SVC_BASENAME}/base || true
docker pull gcr.io/${PROJECT_ID}/${_SVC_BASENAME}/lint || true
docker pull gcr.io/${PROJECT_ID}/${_SVC_BASENAME}/build || true
- name: 'gcr.io/cloud-builders/docker'
args: [
'build',
'--cache-from', 'gcr.io/${PROJECT_ID}/${_SVC_BASENAME}/base',
'--cache-from', 'gcr.io/${PROJECT_ID}/${_SVC_BASENAME}/build',
'--build-arg npm_token=$$NPM_TOKEN',
'--target', 'release',
'.'
]
secretEnv:
- 'NPM_TOKEN'

substitutions:
_SLACK_NOTIFY_CHANNEL: '#triple-web-dev'
_SVC_BASENAME: triple-frontend
_AUTO_TAGGING_ENABLED: 'false'

secrets:
- kmsKeyName: projects/titicaca-ci/locations/global/keyRings/npm/cryptoKeys/publish_token
Expand Down

0 comments on commit 3c49e6b

Please sign in to comment.