From 07ea95825c7d21ddac030b0917270219b94517c2 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 8 Jun 2026 20:51:39 +0200 Subject: [PATCH 01/35] commit1 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c2bec0368b7..31f28f585c0 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,4 @@ 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! +Bartlomiej's version of Boot.dev's Notely app. From 101af05e4c7448483ee69d57aab7e36e0e226f04 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 8 Jun 2026 21:18:37 +0200 Subject: [PATCH 02/35] commit yaml file --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..c3db7596c77 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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.26.0" + + - name: Force Failure + run: (exit 1) From 80deb1d74507227310539db2b84b2965d2bc41d1 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 8 Jun 2026 21:30:18 +0200 Subject: [PATCH 03/35] ci.yml edit to go version instead of exit 1 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3db7596c77..cf7e6891e78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,5 +18,5 @@ jobs: with: go-version: "1.26.0" - - name: Force Failure - run: (exit 1) + - name: Go Version + run: go version From 087f2760174893a7b8f5ac00b2201f5d8ba18f4e Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:09:33 +0200 Subject: [PATCH 04/35] CI that will fail --- .github/workflows/ci.yml | 2 +- internal/auth/get_api_key_test.go | 59 +++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 internal/auth/get_api_key_test.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf7e6891e78..96a2a30e988 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Go Version - run: go version + run: go test ./... diff --git a/internal/auth/get_api_key_test.go b/internal/auth/get_api_key_test.go new file mode 100644 index 00000000000..ae771288862 --- /dev/null +++ b/internal/auth/get_api_key_test.go @@ -0,0 +1,59 @@ +package auth + +import ( + "errors" + "net/http" + "testing" +) + +func TestGetAPIKey(t *testing.T) { + type testCase struct { + name string + headers http.Header + expectedKey string + expectedErr error + failmark int + fail2 uint8 + } + + tests := []testCase{ + { + name: "no authorization header", + headers: http.Header{}, + expectedKey: "", + expectedErr: ErrNoAuthHeaderIncluded, + }, + { + name: "valid API key", + headers: http.Header{ + "Authorization": []string{"ApiKey my-secret-key"}, + }, + expectedKey: "my-secret-key", + expectedErr: nil, + }, + { + name: "malformed header - missing ApiKey prefix", + headers: http.Header{ + "Authorization": []string{"Bearer my-secret-key"}, + }, + expectedKey: "", + expectedErr: errors.New("malformed authorization header"), + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + key, err := GetAPIKey(tc.headers) + + if tc.expectedErr != nil && err == nil { + t.Errorf("expected error %q, got none", tc.expectedErr) + } + if tc.expectedErr == nil && err != nil { + t.Errorf("unexpected error: %v", err) + } + if key != tc.expectedKey { + t.Errorf("expected key %q, got %q", tc.expectedKey, key) + } + }) + } +} From 1b2ade739ec8bd21ea410315b13add1a3fab6cfe Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:13:47 +0200 Subject: [PATCH 05/35] broken message --- internal/auth/get_api_key_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/auth/get_api_key_test.go b/internal/auth/get_api_key_test.go index ae771288862..a521ed78daf 100644 --- a/internal/auth/get_api_key_test.go +++ b/internal/auth/get_api_key_test.go @@ -7,14 +7,12 @@ import ( ) func TestGetAPIKey(t *testing.T) { - type testCase struct { +// type testCase struct { name string headers http.Header expectedKey string expectedErr error - failmark int - fail2 uint8 - } + //} tests := []testCase{ { From 79c4efddc7a7994749b74bdb3f898c610793f2e0 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:21:56 +0200 Subject: [PATCH 06/35] repaired message --- internal/auth/get_api_key_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/auth/get_api_key_test.go b/internal/auth/get_api_key_test.go index a521ed78daf..0dc2ed93871 100644 --- a/internal/auth/get_api_key_test.go +++ b/internal/auth/get_api_key_test.go @@ -7,12 +7,12 @@ import ( ) func TestGetAPIKey(t *testing.T) { -// type testCase struct { + type testCase struct { name string headers http.Header expectedKey string expectedErr error - //} + } tests := []testCase{ { From d7b98c2fa3b393d0f455337a4c99fa98b2e965cf Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:25:46 +0200 Subject: [PATCH 07/35] -cover flag added to ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96a2a30e988..d73c305377b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Go Version - run: go test ./... + run: go test ./.. -cover. From 1ddb0e19a8dd556e933c0c94d6cbc94bae5cffa3 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:28:31 +0200 Subject: [PATCH 08/35] -cover flag added to ci2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d73c305377b..7b5193dea1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Go Version - run: go test ./.. -cover. + run: go test ./... -cover. From ed4a861e831c4dcf834abcf8cda562d4bbf2e445 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:34:48 +0200 Subject: [PATCH 09/35] -cover flag added to ci3 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b5193dea1c..28b8edb7ce2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Go Version - run: go test ./... -cover. + run: go test ./... -cover -v From dfc6d6ddead84d29ce3e6dea6cd6f47177cd851c Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:38:29 +0200 Subject: [PATCH 10/35] -cover flag added to ci4 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28b8edb7ce2..182e1494c3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,5 +18,5 @@ jobs: with: go-version: "1.26.0" - - name: Go Version + - name: Run Go Test run: go test ./... -cover -v From 0071f697fc505cd3bd86996ff172c1ded10af430 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:42:29 +0200 Subject: [PATCH 11/35] -cover flag added to ci5 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 182e1494c3d..f02bf77a7f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Run Go Test - run: go test ./... -cover -v + run: go test -cover ./... From 62b88a749ccaacf99a12afd3baf28e740074bc85 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:46:16 +0200 Subject: [PATCH 12/35] -cover flag added to ci6 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f02bf77a7f6..0dafb096826 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Run Go Test - run: go test -cover ./... + run: go test -cover ./... From fb38cb6503b616accb49ba2e375aba8631f9853d Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:48:52 +0200 Subject: [PATCH 13/35] -cover flag added to ci7 final --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0dafb096826..2fade871b47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,5 +18,5 @@ jobs: with: go-version: "1.26.0" - - name: Run Go Test + - name: go test run: go test -cover ./... From 28bbd718ea97949f2d411faff45e811bbe5a4fdb Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Tue, 9 Jun 2026 16:56:26 +0200 Subject: [PATCH 14/35] readme badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 31f28f585c0..e79531a3f96 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +![CI status](https://github.com/m1kab0/learn-cicd-starter/actions/workflows/ci.yml/badge.svg) # 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). From 8c1cb2d187fedbf2e881c6d4705a9fb30218754a Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Thu, 11 Jun 2026 22:25:03 +0200 Subject: [PATCH 15/35] ci.yaml --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fade871b47..be23ad7314c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,3 +20,6 @@ jobs: - name: go test run: go test -cover ./... + + -style: style test + run: test -z $(go fmt ./...) From 85d1471380b8236e7d48bf1859d33b3b6d19e75a Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Thu, 11 Jun 2026 22:30:18 +0200 Subject: [PATCH 16/35] ci.yaml --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be23ad7314c..2fade871b47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,3 @@ jobs: - name: go test run: go test -cover ./... - - -style: style test - run: test -z $(go fmt ./...) From 11862d26dad4772c34ee9c12e4993ae1feedb62d Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Thu, 11 Jun 2026 22:41:30 +0200 Subject: [PATCH 17/35] ci.yml finished --- .github/workflows/ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fade871b47..47b78c1b7d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,3 +20,18 @@ jobs: - name: go test run: go test -cover ./... +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.26.0" + + - name: Check for Formatting Issues + run: test -z $(go fmt ./...) From 816fa188f567b1e4872c322c1bc6f3e28b722bae Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Thu, 11 Jun 2026 22:45:41 +0200 Subject: [PATCH 18/35] yaml ci --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47b78c1b7d8..ca61a7b4ab6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,8 @@ jobs: - name: go test run: go test -cover ./... -style: + + style: name: Style runs-on: ubuntu-latest From aeaa90fd1b37b7bce92b3298d5c7ff632656ab9b Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Fri, 12 Jun 2026 20:50:35 +0200 Subject: [PATCH 19/35] linting --- .github/workflows/ci.yml | 3 +++ main.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca61a7b4ab6..e542705586c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,3 +36,6 @@ jobs: - name: Check for Formatting Issues run: test -z $(go fmt ./...) + + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest diff --git a/main.go b/main.go index 19d7366c5f7..56c493934dc 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,11 @@ type apiConfig struct { //go:embed static/* var staticFiles embed.FS +func unused() { + // this function does nothing + // and is called nowhere +} + func main() { err := godotenv.Load(".env") if err != nil { From f483e5839ea7de3d7ccfcacf722c2e0d69ad5019 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Fri, 12 Jun 2026 21:02:12 +0200 Subject: [PATCH 20/35] CI gosec test --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e542705586c..b33b2f83725 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,9 @@ jobs: - name: go test run: go test -cover ./... + - name: Install gosec + run: go install github.com/securego/gosec/v2/cmd/gosec@latest + style: name: Style runs-on: ubuntu-latest From eef199e5018aab6158aa13fe43867f2832a7ab66 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Fri, 12 Jun 2026 21:10:01 +0200 Subject: [PATCH 21/35] gosec tun --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b33b2f83725..dfe61d61d17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,9 @@ jobs: - 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 From cd5b6a47d7bdceedfaebe033ec08c7beb837c770 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Fri, 12 Jun 2026 21:18:44 +0200 Subject: [PATCH 22/35] fixed code bugs --- json.go | 5 +++-- main.go | 15 ++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/json.go b/json.go index 1e6e7985e18..26e131ae46a 100644 --- a/json.go +++ b/json.go @@ -29,6 +29,7 @@ func respondWithJSON(w http.ResponseWriter, code int, payload interface{}) { w.WriteHeader(500) return } - w.WriteHeader(code) - w.Write(dat) + if _, err := w.Write(dat); err != nil { + log.Printf("error writing response: %v", err) + } } diff --git a/main.go b/main.go index 56c493934dc..bee79055dfb 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,8 @@ import ( "log" "net/http" "os" + "strings" + "time" "github.com/go-chi/chi" "github.com/go-chi/cors" @@ -24,11 +26,6 @@ type apiConfig struct { //go:embed static/* var staticFiles embed.FS -func unused() { - // this function does nothing - // and is called nowhere -} - func main() { err := godotenv.Load(".env") if err != nil { @@ -94,10 +91,10 @@ func main() { router.Mount("/v1", v1Router) srv := &http.Server{ - Addr: ":" + port, - Handler: router, + Addr: ":" + port, + Handler: router, + ReadHeaderTimeout: 10 * time.Second, } - log.Printf("Serving on port: %s\n", port) - log.Fatal(srv.ListenAndServe()) + log.Printf("Serving on port: %s\n", strings.ReplaceAll(port, "\n", "")) } From 088ce763a08bd71fae2bdc134dd729a1e7c61db6 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Fri, 12 Jun 2026 21:25:34 +0200 Subject: [PATCH 23/35] srv add fix --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index bee79055dfb..b3f4da8f3e5 100644 --- a/main.go +++ b/main.go @@ -97,4 +97,6 @@ func main() { } log.Printf("Serving on port: %s\n", strings.ReplaceAll(port, "\n", "")) + log.Fatal(srv.ListenAndServe()) + } From 6f8cf5343d5e061ea0978775c4f82451ec427885 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Fri, 12 Jun 2026 22:12:43 +0200 Subject: [PATCH 24/35] cd --- .github/workflows/cd.yml | 20 ++++++++++++++++++++ 1 file changed, 20 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 00000000000..a0ccdf22617 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,20 @@ +name: cd + +on: + push: + branches: [main] + +jobs: + Deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Build + run: ./scripts/buildprod.sh \ No newline at end of file From 73f09fccd8d331b6d7f276f7cbf62d080afc4c52 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Sun, 14 Jun 2026 20:49:02 +0200 Subject: [PATCH 25/35] cd google cloud connect --- .github/workflows/cd.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a0ccdf22617..a9103502cc1 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,4 +17,20 @@ jobs: go-version: '1.22' - name: Build - run: ./scripts/buildprod.sh \ No newline at end of file + run: ./scripts/buildprod.sh + + - name: Authenticate to Google Cloud + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_CREDENTIALS }} + + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@v2 + + - name: Configure Docker for Artifact Registry + run: | + gcloud auth configure-docker us-central1-docker.pkg.dev + + - name: Build and Push Docker Image + run: | + gcloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest . \ No newline at end of file From c6a85a3d79c519079c58accab6874cf44419275f Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Sun, 14 Jun 2026 21:25:46 +0200 Subject: [PATCH 26/35] cloud builds submit 3 --- .github/workflows/cd.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a9103502cc1..e6e231e797e 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -28,9 +28,7 @@ jobs: uses: google-github-actions/setup-gcloud@v2 - name: Configure Docker for Artifact Registry - run: | - gcloud auth configure-docker us-central1-docker.pkg.dev + run: gcloud auth configure-docker us-central1-docker.pkg.dev - - name: Build and Push Docker Image - run: | - gcloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest . \ No newline at end of file + - name: cloud builds submit + run: cloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest . \ No newline at end of file From 43466d80cabc823c3583fcaefef46eb92be1b02a Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Sun, 14 Jun 2026 21:36:56 +0200 Subject: [PATCH 27/35] gcloud fix --- .github/workflows/cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e6e231e797e..875a584765b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -30,5 +30,5 @@ jobs: - name: Configure Docker for Artifact Registry run: gcloud auth configure-docker us-central1-docker.pkg.dev - - name: cloud builds submit - run: cloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest . \ No newline at end of file + - name: gcloud builds submit + run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest . \ No newline at end of file From 584b79f8c9ab31049de4cbed5cc7a068a67708c5 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 15 Jun 2026 18:55:40 +0200 Subject: [PATCH 28/35] main: notely cd deploy to cloud --- .github/workflows/cd.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 875a584765b..8e54775b1f7 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -31,4 +31,7 @@ jobs: run: gcloud auth configure-docker us-central1-docker.pkg.dev - name: gcloud builds submit - run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest . \ No newline at end of file + run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest . + + - name: Deploy to Cloud Run + run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely/notely:latest --region us-central1 --allow-unauthenticated --project notely-499416 --max-instances=4 From e1372921ae9cbbad9ad021c1e69b06ce7431ab80 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 15 Jun 2026 19:01:41 +0200 Subject: [PATCH 29/35] main: Welcome to notely change --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index 72be101028c..5d4ad73c095 100644 --- a/static/index.html +++ b/static/index.html @@ -7,7 +7,7 @@ -

Notely

+

Welcome to Notely

From d4694c92b59133d5490dd274356fe5415dd915e5 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 15 Jun 2026 19:05:33 +0200 Subject: [PATCH 30/35] main: cd fix --- .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 8e54775b1f7..16eabe97962 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -34,4 +34,4 @@ jobs: run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest . - name: Deploy to Cloud Run - run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely/notely:latest --region us-central1 --allow-unauthenticated --project notely-499416 --max-instances=4 + run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely-499416 --max-instances=4 From 3e61b3300403a23913b7cde6fb7ca28013af4570 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 15 Jun 2026 19:46:56 +0200 Subject: [PATCH 31/35] main: cd database migration --- .github/workflows/cd.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 16eabe97962..2a7a38a81b0 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -7,6 +7,8 @@ on: jobs: Deploy: runs-on: ubuntu-latest + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -15,10 +17,16 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.22' + + - name: Install goose + run: go install github.com/pressly/goose/v3/cmd/goose@latest - name: Build run: ./scripts/buildprod.sh - + + - name: database migration + run: ./scripts/migrateup.sh + - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 with: @@ -31,7 +39,9 @@ jobs: run: gcloud auth configure-docker us-central1-docker.pkg.dev - name: gcloud builds submit - run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest . + run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest - name: Deploy to Cloud Run run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-499416/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely-499416 --max-instances=4 + + From d9157415751a44beb0c244c2a4548e376b88e216 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 15 Jun 2026 20:35:53 +0200 Subject: [PATCH 32/35] main: cd database migration fix --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index 5d4ad73c095..ab555d3dec7 100644 --- a/static/index.html +++ b/static/index.html @@ -33,7 +33,7 @@

Your Notes

async function createNote() { if (!currentUser) { - alert('Please create a user first'); + alert("Please create a user first"); return; } const noteContent = document.getElementById('newNoteContent').value; From de16b957337d6f4bc26c882d7f30859af878c359 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 15 Jun 2026 20:40:25 +0200 Subject: [PATCH 33/35] main: cd database migration fix 2 --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index ab555d3dec7..3c12452aea2 100644 --- a/static/index.html +++ b/static/index.html @@ -33,7 +33,7 @@

Your Notes

async function createNote() { if (!currentUser) { - alert("Please create a user first"); + alert('śPlease create a user first'); return; } const noteContent = document.getElementById('newNoteContent').value; From 645709469ce8c7e63f5d50b9a3afc80f230b4215 Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 15 Jun 2026 20:47:33 +0200 Subject: [PATCH 34/35] main: cd database migration fix 3 --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index 3c12452aea2..2cde6bcd54b 100644 --- a/static/index.html +++ b/static/index.html @@ -21,7 +21,7 @@

Welcome to Notely

Your Notes

-
+
From 987f65fc505cb0ad13912af42593d164e1a8922c Mon Sep 17 00:00:00 2001 From: m1kab0 Date: Mon, 15 Jun 2026 21:10:26 +0200 Subject: [PATCH 35/35] main: cd database migration fix 4 --- json.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/json.go b/json.go index 26e131ae46a..5be70226eb8 100644 --- a/json.go +++ b/json.go @@ -29,6 +29,8 @@ func respondWithJSON(w http.ResponseWriter, code int, payload interface{}) { w.WriteHeader(500) return } + w.WriteHeader(code) + if _, err := w.Write(dat); err != nil { log.Printf("error writing response: %v", err) }