From 0169f6778eb88d85d1cfbc0b24d334393b51ffd1 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Tue, 25 Nov 2025 16:54:28 +0100 Subject: [PATCH 01/29] readme change --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c2bec0368b..7179b55a27 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,5 @@ go build -o notely && ./notely *This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! + +"Eniola's version of Boot.dev's Notely app." \ No newline at end of file From c59d14499bf724bc2d62bccce1ac0a22d7f3306d Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:41:56 +0100 Subject: [PATCH 02/29] workflow --- .github/workflows/ci.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000000..a54d8248d5 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,22 @@ +name: ci + +on: + pull_request: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.25.1" + + - name: Force Failure + run: (exit 1) \ No newline at end of file From 947542488c8cca4bc480b9c94c5825cd2c904664 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Sun, 30 Nov 2025 08:15:11 +0100 Subject: [PATCH 03/29] test --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 19d7366c5f..fd39ba87c2 100644 --- a/main.go +++ b/main.go @@ -96,3 +96,5 @@ func main() { log.Printf("Serving on port: %s\n", port) log.Fatal(srv.ListenAndServe()) } + +// \ No newline at end of file From d493eed3be69f2604db4cdc4aa88afca7eeb5596 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Sun, 30 Nov 2025 08:19:21 +0100 Subject: [PATCH 04/29] changes to .yaml --- .github/workflows/{ci.yaml => ci.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ci.yaml => ci.yml} (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/ci.yaml rename to .github/workflows/ci.yml From a324e1f84a5cc47975cdb8cb394d80eb5666d625 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Sun, 30 Nov 2025 08:25:37 +0100 Subject: [PATCH 05/29] go version --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a54d8248d5..fed5272ad3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,5 +18,6 @@ jobs: with: go-version: "1.25.1" - - name: Force Failure - run: (exit 1) \ No newline at end of file + - name: Go version + run: go version + \ No newline at end of file From 80ceed430f9d5fb9440cb29a24264d738e7fd4a7 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Sun, 30 Nov 2025 09:29:43 +0100 Subject: [PATCH 06/29] test workflow --- .github/workflows/ci.yml | 5 ++-- internal/auth/auth.go | 2 +- internal/auth/auth_test.go | 54 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 internal/auth/auth_test.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fed5272ad3..f398c608c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,5 @@ jobs: with: go-version: "1.25.1" - - name: Go version - run: go version - \ No newline at end of file + - name: Test + run: go test ./... diff --git a/internal/auth/auth.go b/internal/auth/auth.go index f969aacf63..117eec6645 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -19,5 +19,5 @@ func GetAPIKey(headers http.Header) (string, error) { return "", errors.New("malformed authorization header") } - return splitAuth[1], nil + return splitAuth[0], nil } diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go new file mode 100644 index 0000000000..56f8f414a6 --- /dev/null +++ b/internal/auth/auth_test.go @@ -0,0 +1,54 @@ +package auth +import ( + "testing" + "net/http" +) + +func TestApiKey(t *testing.T) { + tests := []struct { + name string + header http.Header + want string + wantedErr bool + }{ + { + name: "valid token", + header: http.Header{ + "Authorization": []string{"ApiKey validtoken123"}, + }, + want: "validtoken123", + wantedErr: false, + }, + { + name: "missing authorization header", + header: http.Header{}, + want: "", + wantedErr: true, + }, + { + name: "missing ApiKey prefix", + header: http.Header{ + "Authorization": []string{"invalidprefix token123"}, + }, + want: "", + wantedErr: true, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + + got, err := GetAPIKey(test.header) + + // Check error behavior + if (err != nil) != test.wantedErr { + t.Fatalf("Expected error: %v, got: %v", test.wantedErr, err) + } + + // Check token value + if got != test.want { + t.Fatalf("Expected token: %s, got: %s", test.want, got) + } + }) + } +} From aae0a34cd89f41881253308ccdf45ac67486764d Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Sun, 30 Nov 2025 09:31:06 +0100 Subject: [PATCH 07/29] fix --- internal/auth/auth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/auth/auth.go b/internal/auth/auth.go index 117eec6645..f969aacf63 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -19,5 +19,5 @@ func GetAPIKey(headers http.Header) (string, error) { return "", errors.New("malformed authorization header") } - return splitAuth[0], nil + return splitAuth[1], nil } From 47e337a1af4cc9d98f4ccf10c31fe739c3635cd9 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 09:38:24 +0100 Subject: [PATCH 08/29] code coverage --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f398c608c2..a147a94745 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,7 @@ jobs: go-version: "1.25.1" - name: Test - run: go test ./... + run: go test ./... + + - name: Coverage + run: -cover From 2226111ef9c7f8a7818685ec3d3ae75346a078f8 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 09:40:29 +0100 Subject: [PATCH 09/29] code coverage 2 --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a147a94745..50799037f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,4 @@ jobs: go-version: "1.25.1" - name: Test - run: go test ./... - - - name: Coverage - run: -cover + run: go test ./... -cover From 719278487555111aeda4f4c6f56109629a539ca3 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 09:49:23 +0100 Subject: [PATCH 10/29] readme badge for tests --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7179b55a27..eef75ff9a1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # learn-cicd-starter (Notely) This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev). @@ -22,4 +23,7 @@ go build -o notely && ./notely You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! -"Eniola's version of Boot.dev's Notely app." \ No newline at end of file +"Eniola's version of Boot.dev's Notely app." + + + From 7d3c4d5f86b16a5df2f87f511cda64dfd1fa95af Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:15:49 +0100 Subject: [PATCH 11/29] formatting to ci --- .github/workflows/ci.yml | 8 ++++++++ internal/auth/auth_test.go | 5 +++-- main.go | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50799037f7..f5fa756eb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,3 +20,11 @@ jobs: - name: Test run: go test ./... -cover + + Style: + name: Format code + runs-on: ubuntu-latest + + steps: + - name : Code formatting + run: test -z $(go fmt ./...) \ No newline at end of file diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go index 56f8f414a6..368b1ed51c 100644 --- a/internal/auth/auth_test.go +++ b/internal/auth/auth_test.go @@ -1,7 +1,8 @@ package auth + import ( - "testing" "net/http" + "testing" ) func TestApiKey(t *testing.T) { @@ -20,7 +21,7 @@ func TestApiKey(t *testing.T) { wantedErr: false, }, { - name: "missing authorization header", + name: "missing authorization header", header: http.Header{}, want: "", wantedErr: true, diff --git a/main.go b/main.go index fd39ba87c2..97fe50f02b 100644 --- a/main.go +++ b/main.go @@ -97,4 +97,4 @@ func main() { log.Fatal(srv.ListenAndServe()) } -// \ No newline at end of file +// From 12395a663f769a55c8d7bf6033ce6677d9971f9c Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:27:05 +0100 Subject: [PATCH 12/29] added a formatting runner --- .github/workflows/ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5fa756eb1..479e830169 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,10 +21,18 @@ jobs: - name: Test run: go test ./... -cover - Style: - name: Format code + style: + name: Style runs-on: ubuntu-latest steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.25.1" + - name : Code formatting run: test -z $(go fmt ./...) \ No newline at end of file From 53e78e5ccd8d9338c987956e45586532b3bc2476 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:39:37 +0100 Subject: [PATCH 13/29] added linting to CI --- .github/workflows/ci.yml | 5 ++++- main.go | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 479e830169..aec53cc68f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,4 +35,7 @@ jobs: go-version: "1.25.1" - name : Code formatting - run: test -z $(go fmt ./...) \ No newline at end of file + run: test -z $(go fmt ./...) + + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest \ No newline at end of file diff --git a/main.go b/main.go index 97fe50f02b..eb6282634c 100644 --- a/main.go +++ b/main.go @@ -98,3 +98,7 @@ func main() { } // +func unused(){ + // this function does nothing + // and is called nowhere +} \ No newline at end of file From cab053aa8b67bbbc3dad5afae96d8d451985e701 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:45:55 +0100 Subject: [PATCH 14/29] CI linting --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aec53cc68f..1660f5edd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,4 +38,7 @@ jobs: run: test -z $(go fmt ./...) - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@latest \ No newline at end of file + run: go install honnef.co/go/tools/cmd/staticcheck@latest + + - name: linter + run: staticcheck ./... \ No newline at end of file From 2c17d1e76b653b91612833f834ef26ddeb8f5bec Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:47:42 +0100 Subject: [PATCH 15/29] CI formatter fix --- main.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index eb6282634c..a621713c2b 100644 --- a/main.go +++ b/main.go @@ -97,8 +97,7 @@ func main() { log.Fatal(srv.ListenAndServe()) } -// -func unused(){ +func unused() { // this function does nothing - // and is called nowhere -} \ No newline at end of file + // and is called nowhere +} From 3647715cea7a25f0abb8a5cb41201db2d3b70da3 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:49:19 +0100 Subject: [PATCH 16/29] fix: CI linter --- main.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/main.go b/main.go index a621713c2b..19d7366c5f 100644 --- a/main.go +++ b/main.go @@ -96,8 +96,3 @@ func main() { log.Printf("Serving on port: %s\n", port) log.Fatal(srv.ListenAndServe()) } - -func unused() { - // this function does nothing - // and is called nowhere -} From 5fe93035b8db7043ad112753b308a46e350dac33 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:52:49 +0100 Subject: [PATCH 17/29] fix:ci linter --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1660f5edd7..faac1e6f9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,11 +34,10 @@ jobs: with: go-version: "1.25.1" - - name : Code formatting + - name: Code formatting run: test -z $(go fmt ./...) - - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@latest - - - name: linter - run: staticcheck ./... \ No newline at end of file + - name: Linter + uses: dominikh/staticcheck-action@v1 + with: + version: "latest" \ No newline at end of file From a1ac1ca2300ca76cba06cf1b8ea318f7f517e294 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:59:40 +0100 Subject: [PATCH 18/29] added gosec to CI --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index faac1e6f9e..2a0ad31d29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,4 +40,10 @@ jobs: - name: Linter uses: dominikh/staticcheck-action@v1 with: - version: "latest" \ No newline at end of file + version: "latest" + + - name: Install gosec + run: go install github.com/securego/gosec/v2/cmd/gosec@latest + + - name: Run gosec + run: gosec ./... \ No newline at end of file From 15737956ab1c4a0ff75ca4552f2af9d1334b6444 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 11:08:47 +0100 Subject: [PATCH 19/29] fix: gosec issues --- json.go | 5 ++++- main.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/json.go b/json.go index 1e6e7985e1..367055757e 100644 --- a/json.go +++ b/json.go @@ -30,5 +30,8 @@ func respondWithJSON(w http.ResponseWriter, code int, payload interface{}) { return } w.WriteHeader(code) - w.Write(dat) + _, err = w.Write(dat) + if err != nil{ + log.Printf("Critical error writing response: %s", err) + } } diff --git a/main.go b/main.go index 19d7366c5f..7b260066ed 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "log" "net/http" "os" + "time" "github.com/go-chi/chi" "github.com/go-chi/cors" @@ -91,6 +92,7 @@ func main() { srv := &http.Server{ Addr: ":" + port, Handler: router, + ReadHeaderTimeout: time.Second * 5, } log.Printf("Serving on port: %s\n", port) From ee500969fc2061fb6e9f08282758b86427fc31dd Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 11:10:28 +0100 Subject: [PATCH 20/29] format fix --- json.go | 2 +- main.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/json.go b/json.go index 367055757e..c529c90c12 100644 --- a/json.go +++ b/json.go @@ -31,7 +31,7 @@ func respondWithJSON(w http.ResponseWriter, code int, payload interface{}) { } w.WriteHeader(code) _, err = w.Write(dat) - if err != nil{ + if err != nil { log.Printf("Critical error writing response: %s", err) } } diff --git a/main.go b/main.go index 7b260066ed..ec86bb7bf9 100644 --- a/main.go +++ b/main.go @@ -90,8 +90,8 @@ func main() { router.Mount("/v1", v1Router) srv := &http.Server{ - Addr: ":" + port, - Handler: router, + Addr: ":" + port, + Handler: router, ReadHeaderTimeout: time.Second * 5, } From 723cfd7cf34016d8bb31f190d95850ea2ed9faf3 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 11:17:02 +0100 Subject: [PATCH 21/29] fix --- .github/workflows/ci.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a0ad31d29..0b313f86ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,12 @@ jobs: - name: Test run: go test ./... -cover + - name: Install gosec + run: go install github.com/securego/gosec/v2/cmd/gosec@latest + + - name: Run gosec + run: gosec ./... + style: name: Style runs-on: ubuntu-latest @@ -42,8 +48,4 @@ jobs: with: version: "latest" - - name: Install gosec - run: go install github.com/securego/gosec/v2/cmd/gosec@latest - - - name: Run gosec - run: gosec ./... \ No newline at end of file + \ No newline at end of file From 315ca6af62c3ce06d84ed61583a428ed303edd5e Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:02:15 +0100 Subject: [PATCH 22/29] feat: continuous deployment --- .github/workflows/cd.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000000..4acaa27a85 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,22 @@ +name: cd + +on: + push: + branches: [main] + +jobs: + deploy: + name: deploy + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions@checkout@v4 + + - name: Setup code + uses: actions@setup-go@v5 + with: + go-version: "1.25.1" + + - name: Build app + run: ./scripts/buildprod.sh \ No newline at end of file From 47b0297a083525ad8ebf505b11c054b7b089fa82 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:04:17 +0100 Subject: [PATCH 23/29] CD --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 4acaa27a85..bcd93c16ee 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -13,7 +13,7 @@ jobs: - name: Checkout code uses: actions@checkout@v4 - - name: Setup code + - name: Setup Go uses: actions@setup-go@v5 with: go-version: "1.25.1" From be90f29b6a2d1348388274067a195643433b31a5 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:07:13 +0100 Subject: [PATCH 24/29] CD 2 --- .github/workflows/cd.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index bcd93c16ee..d1e1338da4 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -6,15 +6,14 @@ on: jobs: deploy: - name: deploy runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions@checkout@v4 + uses: actions/checkout@v4 - name: Setup Go - uses: actions@setup-go@v5 + uses: actions/setup-go@v5 with: go-version: "1.25.1" From 4dfb4f2e2c53999d9cf9c48692282ee3624b85f7 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 12:13:12 +0100 Subject: [PATCH 25/29] fix on CD 2 --- .github/workflows/cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d1e1338da4..db45950bf5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -6,6 +6,7 @@ on: jobs: deploy: + name: Deploy runs-on: ubuntu-latest steps: From 7973aa63dca7e355e93e5fb7ce87ffd2d0042e96 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 13:09:18 +0100 Subject: [PATCH 26/29] feat:Added GCP to CD, image are deployed and pushed to Aritifact --- .github/workflows/cd.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index db45950bf5..aa790c3f3d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -19,4 +19,18 @@ jobs: go-version: "1.25.1" - name: Build app - run: ./scripts/buildprod.sh \ No newline at end of file + run: ./scripts/buildprod.sh + + - id: 'auth' + uses: google-github-actions/auth@v2 + with: + credentials_json: '${{ secrets.GCP_CREDENTIALS }}' + + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v3' + + - name: 'Use gcloud CLI' + run: 'gcloud info' + + - name: Build docker image and push to Artifact Registry + run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-479911/notely-ar-repo/notely:latest From d6c7e6844ad56451ae69a8e555107d8731fdcf88 Mon Sep 17 00:00:00 2001 From: Eniola Omotee <40490137+eniolaomotee@users.noreply.github.com> Date: Mon, 1 Dec 2025 13:51:47 +0100 Subject: [PATCH 27/29] feat:Added automatic deploy from CI to cloud run --- .github/workflows/cd.yml | 4 ++++ static/index.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index aa790c3f3d..09e3ec2748 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -34,3 +34,7 @@ jobs: - name: Build docker image and push to Artifact Registry run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-479911/notely-ar-repo/notely:latest + + - name: Deploy to Cloud Run + run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-479911/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely-479911 --max-instances=4 + diff --git a/static/index.html b/static/index.html index 72be101028..5d4ad73c09 100644 --- a/static/index.html +++ b/static/index.html @@ -7,7 +7,7 @@
-