# In this directory, run the following command to build this builder.
# $ gcloud builds submit

steps:
# Build all supported versions.
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=6.14.4'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-6.14.4'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=8.12.0'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-8.12.0'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=8.4.0'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-8.4.0'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=9.11.2'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-9.11.2'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=10.10.0'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-10.10.0'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=12.18.3'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-12.18.3'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=14.10.1'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-14.10.1'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=16.18.0'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-16.18.0'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=18.12.0'
  - '--tag=gcr.io/$PROJECT_ID/npm:lts'
  - '--tag=gcr.io/$PROJECT_ID/nodejs/npm'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-18.12.0'
  - '.'
- name: 'gcr.io/cloud-builders/docker'
  args:
  - 'build'
  - '--build-arg=NODE_VERSION=19.0.0'
  - '--tag=gcr.io/$PROJECT_ID/npm:node-19.0.0'
  - '--tag=gcr.io/$PROJECT_ID/npm:latest'
  - '--tag=gcr.io/$PROJECT_ID/npm:current'
  - '.'

# Print for each version
- name: 'gcr.io/$PROJECT_ID/npm:node-6.14.4'
  args: ['version']
- name: 'gcr.io/$PROJECT_ID/npm:node-8.12.0'
  args: ['version']
- name: 'gcr.io/$PROJECT_ID/npm:node-8.4.0'
  args: ['version']
- name: 'gcr.io/$PROJECT_ID/npm:node-9.11.2'
  args: ['version']
- name: 'gcr.io/$PROJECT_ID/npm:node-10.10.0'
  args: ['version']
- name: 'gcr.io/$PROJECT_ID/npm:node-12.18.3'
  args: ['--version']
- name: 'gcr.io/$PROJECT_ID/npm:node-14.10.1'
  args: ['--version']
- name: 'gcr.io/$PROJECT_ID/npm:node-16.18.0'
  args: ['--version']
- name: 'gcr.io/$PROJECT_ID/npm:node-18.12.0'
  args: ['--version']
- name: 'gcr.io/$PROJECT_ID/npm:node-19.0.0'
  args: ['--version']


# Test the examples with :latest
- name: 'gcr.io/$PROJECT_ID/npm:latest'
  args: ['install']
  dir: 'examples/hello_world'
- name: 'gcr.io/$PROJECT_ID/npm:latest'
  args: ['test']
  dir: 'examples/hello_world'
- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '.']
  dir: 'examples/hello_world'
- name: 'gcr.io/$PROJECT_ID/npm:current'
  args: ['install']
  dir: 'examples/hello_world'
- name: 'gcr.io/$PROJECT_ID/npm:current'
  args: ['test']
  dir: 'examples/hello_world'
- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '.']
  dir: 'examples/hello_world'

images:
- 'gcr.io/$PROJECT_ID/npm:lts'
- 'gcr.io/$PROJECT_ID/npm:latest'
- 'gcr.io/$PROJECT_ID/npm:current'
- 'gcr.io/$PROJECT_ID/npm:node-6.14.4'
- 'gcr.io/$PROJECT_ID/npm:node-8.12.0'
- 'gcr.io/$PROJECT_ID/npm:node-8.4.0'
- 'gcr.io/$PROJECT_ID/npm:node-9.11.2'
- 'gcr.io/$PROJECT_ID/npm:node-10.10.0'
- 'gcr.io/$PROJECT_ID/npm:node-12.18.3'
- 'gcr.io/$PROJECT_ID/npm:node-14.10.1'
- 'gcr.io/$PROJECT_ID/npm:node-16.18.0'
- 'gcr.io/$PROJECT_ID/npm:node-18.12.0'
- 'gcr.io/$PROJECT_ID/npm:node-19.0.0'
