diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000000..4d41e101b48 Binary files /dev/null and b/.DS_Store differ diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000000..d727346c81b --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,53 @@ +name: CD + +on: + push: + branches: [main] + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + 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 production binary + run: ./scripts/buildprod.sh + + - name: Authenticate to GCP + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_CREDENTIALS }} + + - name: Set up gcloud + uses: google-github-actions/setup-gcloud@v2 + with: + project_id: notely-483516 + + - name: Build and push Docker image + run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest . + + - name: Run database migrations + run: ./scripts/migrateup.sh + + - name: Deploy to Cloud Run + run: | + gcloud run deploy notely \ + --image us-central1-docker.pkg.dev/notely-483516/notely-ar-repo/notely-app:latest \ + --region us-central1 \ + --allow-unauthenticated \ + --project notely-483516 \ + --max-instances=4 diff --git a/README.md b/README.md index c2bec0368b7..db6ad6f54fb 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ Run the server: go build -o notely && ./notely ``` -*This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. +_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! +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! + +Yaroslav's version of Boot.dev's Notely app. diff --git a/static/index.html b/static/index.html index 72be101028c..35dfb89ce1b 100644 --- a/static/index.html +++ b/static/index.html @@ -7,7 +7,7 @@ -

Notely

+

Welcome to Notely

@@ -190,4 +190,4 @@

Your Notes

- + \ No newline at end of file