-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (32 loc) · 1.05 KB
/
create-user-db.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Create User DB
on:
push:
branches:
- feat/cloudsql-gh-action
workflow_dispatch:
jobs:
create-db:
runs-on: ubuntu-latest
steps:
- id: 'generate-db-id'
name: 'generate db id'
uses: 'yakubique/random-number@v1.1'
with:
min: 111111
max: 999999
- id: 'generate-db-pw'
uses: aammirmirza/RandomPasswordGenerator@v1.1
with:
length: 15
- id: 'auth'
name: 'auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- id: 'Set_up_Cloud_SDK'
name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Use gcloud CLI to create DB'
run: 'gcloud sql databases create ${{ steps.generate-db-id.outputs.number }} --instance=idp-postgres-db'
- name: 'create db user'
run: 'gcloud sql users create ${{ steps.generate-db-id.outputs.number }} --instance=idp-postgres-db --password=${{ steps.generate-db-pw.outputs.password }}