52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
name: cd
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
deploy:
|
|
permissions:
|
|
contents: 'read'
|
|
id-token: 'write'
|
|
|
|
name: Deploy
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
|
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.23.0"
|
|
|
|
- name: Build
|
|
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@v2'
|
|
|
|
- name: 'Use gcloud CLI'
|
|
run: 'gcloud info'
|
|
|
|
- name: Push to Google
|
|
run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-453912/notely-ar-repo/notely:latest .
|
|
|
|
- name: Install Goose
|
|
run: go install github.com/pressly/goose/v3/cmd/goose@latest
|
|
|
|
- name: Run migrations
|
|
run: scripts/migrateup.sh
|
|
|
|
- name: Deploy to Cloud Run
|
|
run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-453912/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely-453912 --max-instances=4 |