-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (55 loc) · 2.27 KB
/
start-stage.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Start Staging Cluster
on: [workflow_dispatch]
jobs:
start-stage:
runs-on: ubuntu-latest
steps:
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GCLOUD_SA_KEY }}
- name: GCloud setup
uses: 'google-github-actions/setup-gcloud@v1'
with:
project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
- id: 'get-credentials'
uses: 'google-github-actions/get-gke-credentials@v1'
with:
cluster_name: ${{ env.PROD_CLUSTER }}
location: ${{ env.GKE_ZONE }}
project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
- name: Copy secrets
run: |
kubectl get secret cloudsql-instance-credentials -oyaml > instance.creds
kubectl get secret cloudsql-db-credentials -oyaml > db.creds
kubectl get secret digitalocean-spaces -oyaml > do.creds
kubectl get secret php-app-key -oyaml > app.creds
kubectl get secret postmarkapp -oyaml > post.creds
kubectl get secret sentry-php -oyaml > sentry.creds
kubectl get secret php-cloud-sql -oyaml > sql.creds
kubectl get secret redis -oyaml > redis.creds
- name: Create cluster
run: gcloud container clusters create "$STAGE_CLUSTER" --zone "$GKE_ZONE" --enable-ip-alias
- id: 'get-stage-credentials'
uses: 'google-github-actions/get-gke-credentials@v1'
with:
cluster_name: ${{ env.STAGE_CLUSTER }}
location: ${{ env.GKE_ZONE }}
project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
- name: Add secrets
run: |
kubectl create secret docker-registry ghcr --docker-server="https://ghcr.io" --docker-username=${{ github.actor }} --docker-password=${{ secrets.DEPLOY_PAT }}
kubectl create -f ./instance.creds
kubectl create -f ./db.creds
kubectl create -f ./do.creds
kubectl create -f ./app.creds
kubectl create -f ./post.creds
kubectl create -f ./sentry.creds
kubectl create -f ./sql.creds
kubectl create -f ./redis.creds
rm *.creds
env:
STAGE_CLUSTER: "staging"
PROD_CLUSTER: "lolibrary-prod"
GKE_ZONE: "us-central1-a"