-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (36 loc) · 1.07 KB
/
test-deploy.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
name: CI/CD Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.2
- name: Install dependencies
run: |
go mod download
- name: test code
env:
DB_URI: ${{ secrets.TEST_DB_URI }}
JWT_SECRET: ${{ secrets.TEST_JWT_SECRET }}
ENVIRONMENT: ${{ secrets.ENVIRONMENT }}
run: |
cd test
go test
- name: Build and push Docker image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build --build-arg JWT_SECRET=${{ secrets.JWT_SECRET }} --build-arg DB_URI=${{ secrets.DB_URI }} -t piyush7833/chat-api .
docker tag chat-api piyush7833/chat-api
docker push piyush7833/chat-api