diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..aa77b09 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,36 @@ +name: cd + +on: + push: + branches: [main] + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + + steps: + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.20" + + - name: Check out code + uses: actions/checkout@v3 + + - name: Build app + run: make + + - id: 'auth' + uses: 'google-github-actions/auth@v1' + with: + credentials_json: '${{ secrets.GCP_CREDENTIALS }}' + + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v1' + + - name: 'Build and push Docker image' + run: 'gcloud builds submit --tag us-central1-docker.pkg.dev/learntocodefyi-prod/learntocodefyi-ar-repo/learntocodefyi:latest .' + + - name: 'Deploy to Cloud Run' + run: 'gcloud run deploy learntocodefyi --image us-central1-docker.pkg.dev/learntocodefyi-prod/learntocodefyi-ar-repo/learntocodefyi:latest --region us-central1 --allow-unauthenticated --project learntocodefyi-prod' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4ef9011 --- /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: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.21" + + - name: Check out code + uses: actions/checkout@v3 + + - name: Run unit tests + run: go test ./... -cover diff --git a/fly.toml b/fly.toml deleted file mode 100644 index 405a03c..0000000 --- a/fly.toml +++ /dev/null @@ -1,17 +0,0 @@ -# fly.toml app configuration file generated for learntocodefyi on 2024-01-02T20:33:21-07:00 -# -# See https://fly.io/docs/reference/configuration/ for information about how to use this file. -# - -app = "learntocodefyi" -primary_region = "sjc" - -[http_service] -internal_port = 8080 -force_https = true -auto_stop_machines = true -auto_start_machines = true -min_machines_running = 0 - -[env] -PLATFORM = "PROD" diff --git a/internal/sendgridwrap/sendgrid.go b/internal/sendgridwrap/sendgrid.go index 833868c..82ea7dd 100644 --- a/internal/sendgridwrap/sendgrid.go +++ b/internal/sendgridwrap/sendgrid.go @@ -14,7 +14,7 @@ const ( ) const ( - LearnToCodeFYIListID = "d9b0b0c0-5b0a-4b0a-9b0a-0b0a0b0a0b0a" + LearnToCodeFYIListID = "ca9ecbeb-2741-4365-9e5e-600058798398" ) // Client - @@ -33,7 +33,7 @@ func NewClient(apiKey, platform string) Client { // SendMagicLink - func (c Client) SendMagicLink(toEmail, toName, loginLink string) error { - const templateID = "d-a8edcea9806b4cdbbb72ff85b8efd93c" + const templateID = "d-6e010242fdb54c819d93ce43f0e3a51c" const fromEmail = "no-reply@learntocode.fyi" const fromName = "LearnToCode.fyi"