Skip to content

cinnect to k8

cinnect to k8 #64

Workflow file for this run

name: Staging Deployment Backend
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: checkout backend
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
name: install dependencies
working-directory:
- run: npm run test
name: test with npm
working-directory:
lint-format:
name: lint and format backend
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
name: checkout backend
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
name: install dependencies
working-directory:
- run: |
if ! npm run format -- --check .; then
echo "Please format the code by running: npm run format"
exit 1
fi
name: check code formatting
working-directory:
build-image:
runs-on: ubuntu-22.04
needs: [lint-format, test]
name: build & push docker image
steps:
- uses: actions/checkout@v4
name: checkout backend
- run: |
ls
name: debug
- name: set up QEMU
uses: docker/setup-qemu-action@v3
- name: set up docker buildx
uses: docker/setup-buildx-action@v3
- name: docker metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: lnart/dryager-backend
tags: |
type=raw,value=${{ github.sha }}
type=raw,value=latest
- name: log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: build and push
uses: docker/build-push-action@v5
with:
context: ./
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ steps.metadata.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
push-staging:
runs-on: ubuntu-22.04
name: deploy changes on staging
needs: build-image
steps:
- name: set the kubernetes context
uses: azure/k8s-set-context@v3
with:
method: service-account
k8s-url: ${{ secrets.KUBE_SERVER_URL }}
k8s-secret: ${{ secrets.KUBE_SERVICE_ACC_SECRET }}
new-tag: ${{github.sha}}
- uses: actions/checkout@v4
name: checkout deployments
with:
submodules: "recursive"
- name: deploy to the kubernetes cluster
uses: azure/k8s-deploy@v4
with:
action: deploy
force: true
strategy: basic
namespace: lennart
manifests: |
kubernetes/blueDeployment.yml
kubernetes/blueService.yml
kubernetes/ingress.yml
images: |
lnart/dryager-backend:${{ github.sha }}