Files
shopadmin/.drone.yml
T
2026-05-16 01:22:17 +02:00

117 lines
3.3 KiB
YAML

---
kind: pipeline
type: docker
name: build
steps:
- name: dotnet-build
image: mcr.microsoft.com/dotnet/sdk:10.0
commands:
- dotnet restore LiteCharmsShopAdmin.slnx
- dotnet build LiteCharmsShopAdmin.slnx -c Release
- name: dotnet-test
image: mcr.microsoft.com/dotnet/sdk:10.0
commands:
- dotnet restore LiteCharmsShopAdmin.slnx
- dotnet test LiteCharmsShopAdmin.slnx -c Release --no-restore
trigger:
event: [ pull_request ]
---
kind: pipeline
type: docker
name: package
steps:
- name: docker-build
image: plugins/docker
settings:
registry: nexus.khongisa.co.za
repo: nexus.khongisa.co.za/litecharms-shopadmin-uat
tags: [ latest, "1.${DRONE_BUILD_NUMBER}" ]
custom_labels:
- org.opencontainers.image.source=https://gitea.khongisa.co.za/litecharms/litecharms-shopadmin-uat
- org.opencontainers.image.version=1.${DRONE_BUILD_NUMBER}
- org.opencontainers.image.revision=${DRONE_COMMIT_SHA}
username: { from_secret: docker_username }
password: { from_secret: docker_password }
- name: gitea-tag-release
image: alpine/git
environment:
GITEA_TOKEN: { from_secret: git_token }
GITEA_USER: { from_secret: git_username }
GITEA_PASS: { from_secret: git_password }
commands:
- echo "169.255.58.144 gitea.khongisa.co.za" >> /etc/hosts
- apk add --no-cache curl
- git remote set-url origin https://$${GITEA_USER}:$${GITEA_PASS}@gitea.khongisa.co.za/litecharms/shopadmin.git
- git tag 1.${DRONE_BUILD_NUMBER}
- git push origin 1.${DRONE_BUILD_NUMBER}
- |
curl -X POST "https://gitea.khongisa.co.za/api/v1/repos/litecharms/shopadmin/releases" \
-H "Authorization: token $${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"1.${DRONE_BUILD_NUMBER}\",
\"target_commitish\": \"${DRONE_COMMIT_SHA}\",
\"name\": \"Release 1.${DRONE_BUILD_NUMBER}\",
\"body\": \"### Artifacts\n* **Docker Image:** nexus.khongisa.co.za/shopadmin:1.${DRONE_BUILD_NUMBER}\n* **NuGet:** [View on Nexus](https://nexus.khongisa.co.za/repository/nuget-group/)\",
\"draft\": false,
\"prerelease\": false
}"
depends_on:
- build
trigger:
event: [ pull_request ]
---
kind: pipeline
type: docker
name: uat
steps:
- name: deploy
image: bitnami/kubectl:latest
environment:
KUBE_CONFIG: { from_secret: kube_config }
commands:
- mkdir -p $HOME/.kube
- echo "$KUBE_CONFIG" > $HOME/.kube/config
- kubectl apply -f litecharms-shopadmin-uat.yml
- sleep 10
- kubectl rollout restart deployment/litecharms-shopadmin -n litecharms-shopadmin-uat
depends_on:
- package
trigger:
event: [ pull_request ]
---
kind: pipeline
type: docker
name: prod
steps:
- name: deploy
image: bitnami/kubectl:latest
environment:
KUBE_CONFIG: { from_secret: kube_config }
commands:
- mkdir -p $HOME/.kube
- echo "$KUBE_CONFIG" > $HOME/.kube/config
- kubectl apply -f litecharms-shopadmin.yml
- sleep 10
- kubectl rollout restart deployment/litecharms-shopadmin -n litecharms-shopadmin
depends_on:
- uat
trigger:
event: [ promote ]
target: [ production ]