Files
nuxt-frontend/.drone.yml
Joris Slagter 3387c39f1b
All checks were successful
continuous-integration/drone/push Build is passing
fix: create .env file during build for axios baseURL configuration
2025-12-03 11:03:20 +01:00

120 lines
2.7 KiB
YAML

kind: pipeline
type: docker
name: default
steps:
# Step 1: Install dependencies and run linting
- name: test
image: node:14
commands:
- npm ci
- npm run lint || echo "⚠ Linting skipped (no lint script found)"
- echo "✓ Dependency installation successful"
# Uncomment when tests are ready:
# - npm test
# Step 2: Build for production (to verify it compiles)
- name: build
image: node:14
environment:
CUSTOMER: Ggz
API_HOST: https://staging-api.ggzecademy.nl
API_HOST_API_SUFFIX: api
commands:
- npm ci
- echo "Creating .env file for build..."
- |
cat > .env << 'EOF'
CUSTOMER=Ggz
API_HOST=https://staging-api.ggzecademy.nl
API_HOST_API_SUFFIX=api
WEBSOCKETS_KEY=staging-key
WEBSOCKETS_HOST=staging-api.ggzecademy.nl
WEBSOCKETS_PORT=6001
EOF
- npm run build
- echo "✓ Build successful"
# Step 3: Deploy to staging
- name: deploy-staging
image: appleboy/drone-ssh
when:
branch:
- develop
- main
event:
- push
settings:
host:
from_secret: staging_host
user: root
key:
from_secret: ssh_private_key
port: 22
envs:
- GITEA_TOKEN
script:
- export GITEA_TOKEN=$GITEA_TOKEN
- /opt/deploy-scripts/deploy-nuxt.sh staging main
environment:
GITEA_TOKEN:
from_secret: gitea_token
# Step 4: Deploy to production (manual trigger only)
- name: deploy-production
image: appleboy/drone-ssh
when:
branch:
- main
event:
- promote
target:
- production
settings:
host:
from_secret: production_host
user: root
key:
from_secret: ssh_private_key
port: 22
envs:
- GITEA_TOKEN
script:
- export GITEA_TOKEN=$GITEA_TOKEN
- /opt/deploy-scripts/deploy-nuxt.sh production main
environment:
GITEA_TOKEN:
from_secret: gitea_token
# Step 5: Notification
- name: notify
image: plugins/slack
when:
status:
- success
- failure
settings:
webhook:
from_secret: slack_webhook
channel: deployments
username: Drone CI
template: >
{{#success build.status}}
✓ Nuxt.js build {{build.number}} succeeded.
Branch: {{build.branch}}
Commit: {{build.commit}}
{{else}}
✗ Nuxt.js build {{build.number}} failed.
Branch: {{build.branch}}
Commit: {{build.commit}}
{{/success}}
failure: ignore
trigger:
branch:
- main
- develop
event:
- push
- promote