2021-10-14 14:59:06 +02:00
|
|
|
---
|
2021-10-14 12:44:51 +02:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
2021-10-14 14:59:06 +02:00
|
|
|
name: test
|
2021-10-14 13:29:44 +02:00
|
|
|
|
2021-10-14 12:44:51 +02:00
|
|
|
# Check if the game builds
|
|
|
|
# If yes, test if everything is nice
|
|
|
|
# If yes, deploy to vercel
|
|
|
|
|
|
|
|
steps:
|
2021-10-14 12:54:04 +02:00
|
|
|
- name: install
|
|
|
|
image: node
|
|
|
|
commands:
|
|
|
|
- yarn
|
|
|
|
- name: build-game
|
|
|
|
image: node
|
|
|
|
commands:
|
|
|
|
- yarn build:game
|
|
|
|
depends_on:
|
|
|
|
- install
|
|
|
|
- name: build-pwa
|
|
|
|
image: node
|
|
|
|
commands:
|
|
|
|
- yarn build:pwa
|
|
|
|
depends_on:
|
|
|
|
- install
|
|
|
|
- name: prettier
|
|
|
|
image: node
|
|
|
|
commands:
|
|
|
|
- yarn lint:prettier:all
|
|
|
|
depends_on:
|
|
|
|
- build-game
|
|
|
|
- build-pwa
|
|
|
|
- name: eslint
|
|
|
|
image: node
|
|
|
|
commands:
|
|
|
|
- yarn lint:eslint --max-warnings=0
|
|
|
|
depends_on:
|
|
|
|
- build-game
|
|
|
|
- build-pwa
|
2021-10-14 13:09:57 +02:00
|
|
|
- name: type-check
|
2021-10-14 12:54:04 +02:00
|
|
|
image: node
|
|
|
|
commands:
|
2021-10-14 13:09:57 +02:00
|
|
|
- yarn type-check
|
2021-10-14 12:54:04 +02:00
|
|
|
depends_on:
|
|
|
|
- build-game
|
|
|
|
- build-pwa
|
2021-10-14 14:59:06 +02:00
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
name: build
|
|
|
|
|
|
|
|
depends_on:
|
|
|
|
- test
|
|
|
|
|
|
|
|
workspace:
|
|
|
|
path: /drone/svelte-sharg
|
|
|
|
|
|
|
|
steps:
|
2021-10-14 12:54:04 +02:00
|
|
|
- name: deploy (production)
|
|
|
|
image: dockette/vercel
|
2021-10-14 13:24:57 +02:00
|
|
|
environment:
|
|
|
|
VERCEL_TOKEN:
|
|
|
|
from_secret: VERCEL_TOKEN
|
|
|
|
VERCEL_SCOPE:
|
|
|
|
from_secret: VERCEL_SCOPE
|
2021-10-14 12:54:04 +02:00
|
|
|
commands:
|
2021-10-14 14:59:06 +02:00
|
|
|
- export VERCEL_BUILD_URL=$(vercel -t $VERCEL_TOKEN --scope $VERCEL_SCOPE -c --prod)
|
2021-10-14 12:54:04 +02:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- main
|
|
|
|
- name: deploy (preview)
|
|
|
|
image: dockette/vercel
|
2021-10-14 13:24:57 +02:00
|
|
|
environment:
|
|
|
|
VERCEL_TOKEN:
|
|
|
|
from_secret: VERCEL_TOKEN
|
|
|
|
VERCEL_SCOPE:
|
|
|
|
from_secret: VERCEL_SCOPE
|
2021-10-14 12:54:04 +02:00
|
|
|
commands:
|
2021-10-14 14:59:06 +02:00
|
|
|
- export VERCEL_BUILD_URL=$(vercel -t $VERCEL_TOKEN --scope $VERCEL_SCOPE -c)
|
2021-10-14 19:02:05 +02:00
|
|
|
- echo VERCEL_BUILD_URL=$VERCEL_BUILD_URL >> .env
|
2021-10-14 12:54:04 +02:00
|
|
|
when:
|
|
|
|
branch:
|
2021-10-14 12:58:26 +02:00
|
|
|
exclude:
|
|
|
|
- main
|
2021-10-14 14:59:06 +02:00
|
|
|
- name: discord notification (private)
|
|
|
|
image: appleboy/drone-discord
|
2021-10-14 19:02:05 +02:00
|
|
|
environment:
|
|
|
|
WEBHOOK_ID_PRIVATE:
|
|
|
|
from_secret: discord_webhook_id_private
|
|
|
|
WEBHOOK_TOKEN_PRIVATE:
|
|
|
|
from_secret: discord_webhook_token_private
|
|
|
|
commands:
|
|
|
|
- source .env
|
|
|
|
- |-
|
|
|
|
export MESSAGE='{{#success build.status}}
|
|
|
|
✅ Build #{{build.number}} of `{{repo.name}}` succeeded.{{else}}
|
|
|
|
❌ Build #{{build.number}} of `{{repo.name}}` failed.{{/success}}
|
2021-10-14 17:41:56 +02:00
|
|
|
|
|
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
|
|
```
|
|
|
|
{{commit.message}}
|
2021-10-14 19:02:05 +02:00
|
|
|
```
|
|
|
|
🌐 {{ build.link }}
|
|
|
|
🌐 '$VERCEL_BUILD_URL
|
|
|
|
- >-
|
|
|
|
drone-discord
|
|
|
|
--webhook-id $WEBHOOK_ID_PRIVATE
|
|
|
|
--webhook-token $WEBHOOK_TOKEN_PRIVATE
|
|
|
|
depends_on:
|
|
|
|
- deploy (production)
|
|
|
|
- deploy (preview)
|
2021-10-14 14:59:06 +02:00
|
|
|
- name: discord notification (dev server)
|
|
|
|
image: appleboy/drone-discord
|
2021-10-14 19:02:05 +02:00
|
|
|
environment:
|
|
|
|
WEBHOOK_ID_DEV_SERVER:
|
|
|
|
from_secret: discord_webhook_id_dev_server
|
|
|
|
WEBHOOK_TOKEN_DEV_SERVER:
|
|
|
|
from_secret: discord_webhook_token_dev_server
|
|
|
|
commands:
|
|
|
|
- source .env
|
|
|
|
- |-
|
|
|
|
export MESSAGE='{{#success build.status}}
|
|
|
|
✅ Build #{{build.number}} of `{{repo.name}}` succeeded.{{else}}
|
|
|
|
❌ Build #{{build.number}} of `{{repo.name}}` failed.{{/success}}
|
2021-10-14 17:41:56 +02:00
|
|
|
|
|
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
|
|
```
|
|
|
|
{{commit.message}}
|
2021-10-14 19:02:05 +02:00
|
|
|
```
|
|
|
|
🌐 {{ build.link }}
|
|
|
|
🌐 '$VERCEL_BUILD_URL
|
|
|
|
- >-
|
|
|
|
drone-discord
|
|
|
|
--webhook-id $WEBHOOK_ID_DEV_SERVER
|
|
|
|
--webhook-token $WEBHOOK_TOKEN_DEV_SERVER
|
|
|
|
depends_on:
|
|
|
|
- deploy (production)
|
|
|
|
- deploy (preview)
|