This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
env: | |
DATABASE_URL: '${{ secrets.DATABASE_URL }}' | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: setup go toolchain | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
- name: build | |
run: ./scripts/buildprod.sh | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GCP_JSON_KEY }}' | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: 'Use gcloud CLI' | |
run: 'gcloud info' | |
- name: 'gcloud builds submit' | |
run: 'gcloud builds submit --tag us-central1-docker.pkg.dev/notely-434019/notely-ar-repo/notely:latest .' | |
- name: install goose | |
run: 'go install github.com/pressly/goose/v3/cmd/goose@latest' | |
- name: migrateup.sh | |
run: './scripts/migrateup.sh' | |
- name: Deploy to Cloud Run | |
run: 'gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-434019/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely-434019 --max-instances=4' | |