Skip to content

Commit

Permalink
cd testing
Browse files Browse the repository at this point in the history
Signed-off-by: dhruv <[email protected]>
  • Loading branch information
jaydee029 committed Mar 27, 2024
1 parent 18e6cf4 commit eeef707
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 16 deletions.
48 changes: 42 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
name: cd

on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]

jobs:

deploy:
name: deploy
runs-on: ubuntu-latest

steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"

- name: Checkout code
uses: actions/checkout@v3

- name: Build the app
run: ./scripts/build.sh

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-south-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1


- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: verses
IMAGE_TAG: verses:latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
4 changes: 2 additions & 2 deletions create_prose.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

"github.com/go-chi/chi/v5"
"github.com/google/uuid"
auth "github.com/jaydee029/Barkin/internal"
"github.com/jaydee029/Barkin/internal/database"
auth "github.com/jaydee029/Verses/internal"
"github.com/jaydee029/Verses/internal/database"
)

type Res struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/jaydee029/Barkin
module github.com/jaydee029/Verses

go 1.20

Expand Down
10 changes: 7 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
_ "github.com/lib/pq"

"github.com/go-chi/chi/v5"
"github.com/jaydee029/Barkin/internal/database"
"github.com/jaydee029/Verses/internal/database"
"github.com/joho/godotenv"
)

Expand All @@ -22,8 +22,12 @@ type apiconfig struct {
}

func main() {
godotenv.Load(".env")

err := godotenv.Load(".env")

Check failure on line 25 in main.go

View workflow job for this annotation

GitHub Actions / formatting tests

this value of err is never used (SA4006)
/*
if err != nil {
log.Fatal(".env file not provided")
}
*/
jwt_secret := os.Getenv("JWT_SECRET")
if jwt_secret == "" {
log.Fatal("JWT secret key not set")
Expand Down
4 changes: 2 additions & 2 deletions prose.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/go-chi/chi/v5"
"github.com/google/uuid"
auth "github.com/jaydee029/Barkin/internal"
"github.com/jaydee029/Barkin/internal/database"
auth "github.com/jaydee029/Verses/internal"
"github.com/jaydee029/Verses/internal/database"
)

type Prose struct {
Expand Down
4 changes: 2 additions & 2 deletions users.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"time"

"github.com/google/uuid"
auth "github.com/jaydee029/Barkin/internal"
"github.com/jaydee029/Barkin/internal/database"
auth "github.com/jaydee029/Verses/internal"
"github.com/jaydee029/Verses/internal/database"
"golang.org/x/crypto/bcrypt"
)

Expand Down

0 comments on commit eeef707

Please sign in to comment.