-
Notifications
You must be signed in to change notification settings - Fork 402
123 lines (103 loc) · 3.43 KB
/
solar-system.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Solar System Workflow
on:
workflow_dispatch:
push:
branches:
- main
- 'feature/*'
env:
MONGO_URI: mongodb+srv://supercluster.d83jj.mongodb.net/superData
MONGO_USERNAME: superuser
MONGO_PASSWORD: ${{ secrets.MONGO_PASSWORD }}
jobs:
unit-testing:
name: Unit Testing
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup NodeJS Version
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install Dependencies
run: npm install
- name: Unit Testing
run: npm test
- name: Archive Test Result
uses: actions/upload-artifact@v3
with:
name: Mocha-Test-Result
path: test-results.xml
docker:
permissions: #added
packages: write #added
runs-on: ubuntu-latest
needs:
#- code-coverage
- unit-testing
steps:
- uses: actions/checkout@v4
- uses: docker/[email protected]
with:
#registry: ghcr.io
registry: docker.io
#username: '${{ github.repository_owner }}'
username: 'seyiogunniran'
# password: '${{ secrets.GITHUB_TOKEN }}'
password: '${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}'
- uses: docker/build-push-action@v4
with:
context: .
push: true
tags: 'docker.io/seyiogunniran/solar-system:${{ github.sha }}'
#tags: 'ghcr.io/${{ github.repository_owner }}/solar-system:${{ github.sha }}'
dev-deploy:
needs: docker
runs-on: ubuntu-latest
environment:
name: development
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install kubectl Cli
uses: azure/setup-kubectl@v3
with:
version: v1.26.0
- name: Set kubconfig file
uses: azure/k8s-set-context@v3
with:
method: kubeconfig
kubeconfig: '${{ secrets.KUBECONFIG }}'
- name: Fetch kubernetes cluster details
run: |
kubectl version --short -o yaml
echo --------------------------
kubectl get nodes
- name: Save AWS Ingress Controller IP as a GITHUB Env variable
run: |
kubectl get ingress -n game-2048
- name: Replace Token in Manifest files
uses: cschleiden/replace-tokens@v1
with:
tokenPrefix: '_{_'
tokenSuffix: '_}_'
files: '["kubernetes/development/*.yaml"]'
env:
NAMESPACE: ${{ vars.NAMESPACE }}
REPLICAS: ${{ vars.REPLICAS }}
IMAGE: docker.io/seyiogunniran/solar-systems:${{ github.sha }}
- name: Check files list
run: cat kubernetes/development/*.yaml
- name: Create MongoDB Seceret
run: |
kubectl -n ${{ vars.NAMESPACE }} create secret generic mongo-db-creds
---literal=MONGO_URI=${{ env.MONGO_URI }} \
---literal=MONGO_USERNAME=${{ env.MONGO_USERNAME }} \
---literal=MONGO_PASSWORD=${{ secrets.MONGO_PASSWORD }} \
---save-config \
---dry-run=client \
-o yaml | kubectl apply -f -
- name: Deploy kubernetes
run: |
kubectl apply -f kubernetes/development