Files
k9e.no/.drone.yml
2023-11-04 22:13:02 +01:00

71 lines
1.5 KiB
YAML

---
kind: pipeline
type: docker
name: Build and publish
platform:
os: linux
arch: amd64
steps:
- name: Lint project
image: node:21-alpine3.17
commands:
- yarn
- yarn lint
- name: Build app
image: node:21-alpine3.17
commands:
- yarn
- yarn build
- name: Publish docker image
image: plugins/docker
settings:
registry: ghcr.io
repo: ghcr.io/kevinmidboe/k9e.no
dockerfile: Dockerfile
username:
from_secret: GITHUB_USERNAME
password:
from_secret: GITHUB_PASSWORD
tags: latest
when:
event:
include:
- push
exclude:
- pull_request
branch:
- main
- name: Deploy app to kubernetes
image: alpine/k8s:1.25.15
commands:
- kubectl config set-cluster $KUBE_CLUSTER --server=$KUBE_SERVER
- kubectl config set-credentials $KUBE_USER --token=$KUBE_TOKEN
- kubectl config set-context $KUBE_CONTEXT --cluster=$KUBE_CLUSTER --user=$KUBE_USER
- kubectl config use-context $KUBE_CONTEXT
- kubectl get pods
environment:
KUBE_CLUSTER:
from_secret: KUBE_CLUSTER
KUBE_USER:
from_secret: KUBE_USER
KUBE_SERVER:
from_secret: KUBE_SERVER
KUBE_TOKEN:
from_secret: KUBE_TOKEN
KUBE_CONTEXT:
from_secret: KUBE_CONTEXT
when:
event:
include:
- push
exclude:
- pull_request
branch:
- main
- kube