-
Notifications
You must be signed in to change notification settings - Fork 3
48 lines (43 loc) · 1.58 KB
/
dev-backend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Backend Build & Deploy
on:
push:
branches: [dev]
paths:
- 'backend/**'
jobs:
backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- run: cd backend
- name: set version
run: echo "TAG_VERSION=dev.$(date +'%y-%m-%d').$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
- name: Login to DockerHub
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push backend
uses: docker/build-push-action@v5
with:
context: backend/
platforms: linux/amd64,linux/arm64
push: true
tags: |
sayinmehmet47/backend-kitapkurdu-1:dev
sayinmehmet47/backend-kitapkurdu-1:${{ env.TAG_VERSION }}
- name: Deploy to Kubernetes
run: |
kubectl config set-cluster kubernetes \
--server="https://rancher.riwi.dev/k8s/clusters/c-m-cp898j4l"
kubectl config set-credentials github-action \
--token=${{ secrets.KUBE_CONFIG_TOKEN }}
kubectl config set-context default \
--cluster=kubernetes \
--user=github-action
kubectl config use-context default
kubectl set image deployment/backend-deployment-dev kitapkurdu=sayinmehmet47/backend-kitapkurdu-1:${{ env.TAG_VERSION }} -n kitapkurdu