From 3152e71ce71223c8543e38bcf0ec27e51ad00245 Mon Sep 17 00:00:00 2001 From: Tobias Berger Date: Thu, 14 Oct 2021 19:02:05 +0200 Subject: [PATCH] Fix discord message --- .drone.yml | 113 ++++++++++++++++++++++------------------------------- 1 file changed, 47 insertions(+), 66 deletions(-) diff --git a/.drone.yml b/.drone.yml index 7b6f86e..5138038 100644 --- a/.drone.yml +++ b/.drone.yml @@ -78,81 +78,62 @@ steps: from_secret: VERCEL_SCOPE commands: - export VERCEL_BUILD_URL=$(vercel -t $VERCEL_TOKEN --scope $VERCEL_SCOPE -c) + - echo VERCEL_BUILD_URL=$VERCEL_BUILD_URL >> .env when: branch: exclude: - main - ---- -kind: pipeline -name: notify - -clone: - disable: true - -depends_on: - - build - -steps: - - name: sync - image: alpine - name: discord notification (private) image: appleboy/drone-discord - settings: - message: | - {{#success build.status}} - ``` - ✅ Build #{{build.number}} of `{{repo.name}}` succeeded. - - 📝 Commit by {{commit.author}} on `{{commit.branch}}`: - ------------------------------------------------------- - {{commit.message}} - ------------------------------------------------------- - 🌐 {{ build.link }}``` - {{else}} - ``` - ❌ Build #{{build.number}} of `{{repo.name}}` failed. - - 📝 Commit by {{commit.author}} on `{{commit.branch}}`: - ------------------------------------------------------- - {{commit.message}} - ------------------------------------------------------- - - 🌐 {{ build.link }}``` - {{/success}}" - webhook_id: + environment: + WEBHOOK_ID_PRIVATE: from_secret: discord_webhook_id_private - webhook_token: + WEBHOOK_TOKEN_PRIVATE: from_secret: discord_webhook_token_private - depends_on: - - sync + commands: + - source .env + - |- + export MESSAGE='{{#success build.status}} + ✅ Build #{{build.number}} of `{{repo.name}}` succeeded.{{else}} + ❌ Build #{{build.number}} of `{{repo.name}}` failed.{{/success}} + + 📝 Commit by {{commit.author}} on `{{commit.branch}}`: + ``` + {{commit.message}} + ``` + 🌐 {{ build.link }} + 🌐 '$VERCEL_BUILD_URL + - >- + drone-discord + --webhook-id $WEBHOOK_ID_PRIVATE + --webhook-token $WEBHOOK_TOKEN_PRIVATE + depends_on: + - deploy (production) + - deploy (preview) - name: discord notification (dev server) image: appleboy/drone-discord - settings: - message: | - {{#success build.status}} - ``` - ✅ Build #{{build.number}} of `{{repo.name}}` succeeded. - - 📝 Commit by {{commit.author}} on `{{commit.branch}}`: - ------------------------------------------------------- - {{commit.message}} - ------------------------------------------------------- - 🌐 {{ build.link }}``` - {{else}} - ``` - ❌ Build #{{build.number}} of `{{repo.name}}` failed. - - 📝 Commit by {{commit.author}} on `{{commit.branch}}`: - ------------------------------------------------------- - {{commit.message}} - ------------------------------------------------------- - - 🌐 {{ build.link }}``` - {{/success}}" - webhook_id: + environment: + WEBHOOK_ID_DEV_SERVER: from_secret: discord_webhook_id_dev_server - webhook_token: + WEBHOOK_TOKEN_DEV_SERVER: from_secret: discord_webhook_token_dev_server - depends_on: - - sync + commands: + - source .env + - |- + export MESSAGE='{{#success build.status}} + ✅ Build #{{build.number}} of `{{repo.name}}` succeeded.{{else}} + ❌ Build #{{build.number}} of `{{repo.name}}` failed.{{/success}} + + 📝 Commit by {{commit.author}} on `{{commit.branch}}`: + ``` + {{commit.message}} + ``` + 🌐 {{ 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)