Skip to content

Commit

Permalink
seperate build and deploy steps
Browse files Browse the repository at this point in the history
  • Loading branch information
khanzadimahdi committed Jan 9, 2025
1 parent 7c02a3d commit 14be04a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
push: false
container-registry: ${{ env.REGISTRY }}

cd:
build-and-push-images:
runs-on: ubuntu-latest

if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}
Expand Down Expand Up @@ -76,6 +76,18 @@ jobs:
container-registry-username: ${{ github.actor }}
container-registry-password: ${{ secrets.GITHUB_TOKEN }}

deploy:
runs-on: ubuntu-latest

if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}

needs:
- build-and-push-images

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Deploy services
run: |
# Setup ssh key
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
push: false
container-registry: ${{ env.REGISTRY }}

cd:
build-and-push-images:
runs-on: ubuntu-latest

if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}
Expand Down Expand Up @@ -67,6 +67,18 @@ jobs:
container-registry-username: ${{ github.actor }}
container-registry-password: ${{ secrets.GITHUB_TOKEN }}

deploy:
runs-on: ubuntu-latest

if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}

needs:
- build-and-push-images

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Deploy services
run: |
# Setup ssh key
Expand Down
2 changes: 2 additions & 0 deletions backend/presentation/http/api/home/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package home

import (
"encoding/json"
"log"
"net/http"

"github.com/khanzadimahdi/testproject/application/home"
Expand All @@ -22,6 +23,7 @@ func (h *homeHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {

switch {
case err != nil:
log.Println(err)
rw.WriteHeader(http.StatusInternalServerError)
default:
rw.Header().Add("Content-Type", "application/json")
Expand Down

0 comments on commit 14be04a

Please sign in to comment.