51 lines
1.7 KiB
YAML
51 lines
1.7 KiB
YAML
# Production Deploy (run via Woodpecker UI: trigger deployment to "production")
|
|
# No clone: runs without repo checkout; triggers Portainer stack webhook.
|
|
# Secrets required: portainer_webhook_url (Portainer stack webhook URL), discord_webhook_url (Discord incoming webhook).
|
|
skip_clone: true
|
|
|
|
# Use /tmp so rootless step containers (e.g. curlimages/curl) can create the workspace.
|
|
workspace:
|
|
base: /tmp
|
|
path: woodpecker
|
|
|
|
when:
|
|
event: deployment
|
|
evaluate: 'CI_PIPELINE_DEPLOY_TARGET == "production"'
|
|
|
|
steps:
|
|
- name: Deploy to Production
|
|
image: curlimages/curl
|
|
environment:
|
|
PORTAINER_WEBHOOK_URL:
|
|
from_secret: portainer_webhook_url
|
|
commands:
|
|
- curl -sS -X POST "$PORTAINER_WEBHOOK_URL"
|
|
|
|
- name: Send Deploy Status Notification (success)
|
|
image: curlimages/curl
|
|
environment:
|
|
DISCORD_WEBHOOK_URL:
|
|
from_secret: discord_webhook_url
|
|
commands:
|
|
- |
|
|
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Production Deploy success 🎉"}' "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
|
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" "$DISCORD_WEBHOOK_URL"
|
|
depends_on:
|
|
- Deploy to Production
|
|
when:
|
|
- status: [ success ]
|
|
|
|
- name: Send Deploy Status Notification (failure)
|
|
image: curlimages/curl
|
|
environment:
|
|
DISCORD_WEBHOOK_URL:
|
|
from_secret: discord_webhook_url
|
|
commands:
|
|
- |
|
|
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Production Deploy failure 💩"}' "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
|
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" "$DISCORD_WEBHOOK_URL"
|
|
depends_on:
|
|
- Deploy to Production
|
|
when:
|
|
- status: [ failure ]
|