build:
  image: node:20.8.1
  stage: build
  before_script:
    # - ./update_version.sh
    - echo $CI_COMMIT_TIMESTAMP $CI_COMMIT_SHORT_SHA > src/assets/version.txt
    - npm install -g workbox-cli
  script:
    - export NODE_OPTIONS=--openssl-legacy-provider
    - npm ci
    - npm run build
  artifacts:
    paths:
      - dist


s3:
  stage: deploy
  image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
  script:
  - aws s3 sync ./dist s3://gp-web-prod-shared-weblite-bucket --delete
  only:
  - main

s3-dev:
  stage: deploy
  image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
  script:
  - aws s3 sync ./dist s3://gp-web-prod-shared-weblite-bucket-dev --delete
  only:
  - dev
