2023-10-19 17:07:16 -07:00
|
|
|
image: node:21
|
2020-04-14 11:07:40 -07:00
|
|
|
|
|
|
|
variables:
|
|
|
|
NODE_ENV: test
|
2023-09-13 12:15:35 -07:00
|
|
|
DS_EXCLUDED_ANALYZERS: gemnasium-python
|
2020-04-14 11:07:40 -07:00
|
|
|
|
2022-12-30 09:39:08 -08:00
|
|
|
default:
|
|
|
|
interruptible: true
|
|
|
|
|
2022-06-17 17:02:58 -07:00
|
|
|
cache: &cache
|
2021-08-23 12:36:14 -07:00
|
|
|
key:
|
|
|
|
files:
|
|
|
|
- yarn.lock
|
|
|
|
paths:
|
2022-05-17 04:39:59 -07:00
|
|
|
- node_modules/
|
2022-06-17 17:02:58 -07:00
|
|
|
policy: pull
|
2020-04-14 16:00:02 -07:00
|
|
|
|
2020-04-14 11:07:40 -07:00
|
|
|
stages:
|
2022-05-25 08:00:28 -07:00
|
|
|
- deps
|
2020-04-14 11:07:40 -07:00
|
|
|
- test
|
2020-08-30 11:59:39 -07:00
|
|
|
- deploy
|
2022-12-28 17:45:41 -08:00
|
|
|
- release
|
2020-04-14 11:07:40 -07:00
|
|
|
|
2022-05-25 08:00:28 -07:00
|
|
|
deps:
|
|
|
|
stage: deps
|
|
|
|
script: yarn install --ignore-scripts
|
2022-05-25 12:36:30 -07:00
|
|
|
only:
|
|
|
|
changes:
|
|
|
|
- yarn.lock
|
2022-06-17 17:02:58 -07:00
|
|
|
cache:
|
|
|
|
<<: *cache
|
|
|
|
policy: push
|
2020-04-14 11:07:40 -07:00
|
|
|
|
2023-09-18 16:12:15 -07:00
|
|
|
lint:
|
2022-05-25 07:58:19 -07:00
|
|
|
stage: test
|
2023-09-18 16:12:15 -07:00
|
|
|
script: yarn lint
|
2021-08-22 14:17:31 -07:00
|
|
|
only:
|
|
|
|
changes:
|
|
|
|
- "**/*.js"
|
2022-03-18 13:36:15 -07:00
|
|
|
- "**/*.jsx"
|
2023-01-17 16:34:11 -08:00
|
|
|
- "**/*.cjs"
|
|
|
|
- "**/*.mjs"
|
2022-03-18 13:36:15 -07:00
|
|
|
- "**/*.ts"
|
|
|
|
- "**/*.tsx"
|
2021-08-22 14:17:31 -07:00
|
|
|
- "**/*.scss"
|
|
|
|
- "**/*.css"
|
2023-09-18 16:12:15 -07:00
|
|
|
- ".eslintignore"
|
2023-12-21 09:16:29 -08:00
|
|
|
- ".eslintrc.json"
|
2021-08-22 14:17:31 -07:00
|
|
|
- ".stylelintrc.json"
|
2020-04-14 11:07:40 -07:00
|
|
|
|
2023-09-18 09:27:19 -07:00
|
|
|
build:
|
2022-05-25 08:15:41 -07:00
|
|
|
stage: test
|
2023-09-18 11:06:54 -07:00
|
|
|
before_script:
|
|
|
|
- apt-get update -y && apt-get install -y zip
|
2022-12-28 22:17:29 -08:00
|
|
|
script:
|
|
|
|
- yarn build
|
2023-09-18 09:27:19 -07:00
|
|
|
- cp dist/index.html dist/404.html
|
2023-09-18 10:54:21 -07:00
|
|
|
- cd dist && zip -r ../soapbox.zip . && cd ..
|
2020-04-14 11:20:07 -07:00
|
|
|
variables:
|
|
|
|
NODE_ENV: production
|
2020-04-14 11:07:40 -07:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2023-09-18 10:54:21 -07:00
|
|
|
- soapbox.zip
|
2020-04-14 11:07:40 -07:00
|
|
|
|
2023-10-11 13:19:47 -07:00
|
|
|
i18n:
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- yarn i18n
|
|
|
|
- git diff --quiet || (echo "Locale files are out of date. Please run `yarn i18n`" && exit 1)
|
|
|
|
|
2020-08-30 11:59:39 -07:00
|
|
|
docs-deploy:
|
|
|
|
stage: deploy
|
|
|
|
image: alpine:latest
|
2020-08-29 14:51:17 -07:00
|
|
|
before_script:
|
|
|
|
- apk add curl
|
|
|
|
script:
|
2020-08-30 11:49:42 -07:00
|
|
|
- curl -X POST -F"token=$CI_JOB_TOKEN" -F'ref=master' https://gitlab.com/api/v4/projects/15685485/trigger/pipeline
|
2020-08-29 11:18:51 -07:00
|
|
|
only:
|
2022-12-31 18:50:05 -08:00
|
|
|
variables:
|
|
|
|
- $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
|
2021-08-22 14:17:31 -07:00
|
|
|
changes:
|
|
|
|
- "docs/**/*"
|
2021-08-21 21:48:29 -07:00
|
|
|
|
2022-05-18 19:48:16 -07:00
|
|
|
review:
|
|
|
|
stage: deploy
|
|
|
|
environment:
|
|
|
|
name: review/$CI_COMMIT_REF_NAME
|
|
|
|
url: https://$CI_COMMIT_REF_SLUG.git.soapbox.pub
|
2023-09-18 11:30:55 -07:00
|
|
|
before_script:
|
|
|
|
- apt-get update -y && apt-get install -y unzip
|
2022-05-18 19:48:16 -07:00
|
|
|
script:
|
2023-09-18 11:38:32 -07:00
|
|
|
- unzip soapbox.zip -d dist
|
2023-09-18 09:27:19 -07:00
|
|
|
- npx -y surge dist $CI_COMMIT_REF_SLUG.git.soapbox.pub
|
2022-05-25 08:23:55 -07:00
|
|
|
allow_failure: true
|
2022-05-18 19:48:16 -07:00
|
|
|
|
2021-08-21 21:48:29 -07:00
|
|
|
pages:
|
|
|
|
stage: deploy
|
2023-09-18 11:30:55 -07:00
|
|
|
before_script:
|
|
|
|
- apt-get update -y && apt-get install -y unzip
|
2021-08-21 21:48:29 -07:00
|
|
|
script:
|
2021-09-06 21:59:19 -07:00
|
|
|
# artifacts are kept between jobs
|
2023-09-18 11:38:32 -07:00
|
|
|
- unzip soapbox.zip -d public
|
2021-09-06 21:56:29 -07:00
|
|
|
variables:
|
|
|
|
NODE_ENV: production
|
2021-08-21 21:48:29 -07:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
only:
|
2022-12-31 18:50:05 -08:00
|
|
|
variables:
|
|
|
|
- $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
|
2022-09-04 13:37:34 -07:00
|
|
|
|
|
|
|
docker:
|
2022-09-04 13:58:48 -07:00
|
|
|
stage: deploy
|
2024-02-11 08:07:01 -08:00
|
|
|
image: docker:25.0.3
|
2022-09-04 13:37:34 -07:00
|
|
|
services:
|
2024-02-11 08:07:01 -08:00
|
|
|
- docker:25.0.3-dind
|
2022-10-09 09:33:10 -07:00
|
|
|
tags:
|
|
|
|
- dind
|
2022-09-04 13:37:34 -07:00
|
|
|
# https://medium.com/devops-with-valentine/how-to-build-a-docker-image-and-push-it-to-the-gitlab-container-registry-from-a-gitlab-ci-pipeline-acac0d1f26df
|
|
|
|
script:
|
|
|
|
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
|
2023-02-15 17:55:56 -08:00
|
|
|
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG .
|
|
|
|
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
interruptible: false
|
2022-12-28 17:45:41 -08:00
|
|
|
|
|
|
|
release:
|
|
|
|
stage: release
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
script:
|
2023-10-11 11:06:45 -07:00
|
|
|
- npx tsx ./scripts/do-release.ts
|
2023-01-08 14:32:35 -08:00
|
|
|
interruptible: false
|
|
|
|
|
2022-12-28 22:04:02 -08:00
|
|
|
include:
|
2022-12-29 07:49:39 -08:00
|
|
|
- template: Jobs/Dependency-Scanning.gitlab-ci.yml
|