This repository has been archived by the owner on Apr 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (110 loc) · 3.47 KB
/
deploy.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Deploy
on: workflow_dispatch
jobs:
test-go:
uses: k0swe/forester-func/.github/workflows/test-go.yml@main
deploy-golang-http:
name: Deploy Golang HTTP
runs-on: ubuntu-latest
needs: test-go
strategy:
matrix:
function-name: [ ImportQrz, ImportLotw, UpdateSecret ]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: GCP Auth
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Cloud Functions Deploy
uses: google-github-actions/deploy-cloud-functions@main
with:
name: ${{ matrix.function-name }}
entry_point: ${{ matrix.function-name }}
runtime: go119
env_vars: GCP_PROJECT=k0swe-kellog
deploy_timeout: 3600
deploy-golang-pubsub:
runs-on: ubuntu-latest
name: Deploy Golang PubSub
needs: test-go
strategy:
matrix:
function-spec: [
{ name: SyncNewQso, trigger: projects/k0swe-kellog/topics/contact-created }
]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: GCP Auth
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Cloud Functions Deploy
uses: google-github-actions/deploy-cloud-functions@main
with:
name: ${{ matrix.function-spec.name }}
entry_point: ${{ matrix.function-spec.name }}
event_trigger_type: google.pubsub.topic.publish
event_trigger_resource: ${{ matrix.function-spec.trigger }}
runtime: go119
env_vars: GCP_PROJECT=k0swe-kellog
deploy_timeout: 3600
test-js:
uses: k0swe/forester-func/.github/workflows/test-js.yml@main
deploy-javascript:
runs-on: ubuntu-latest
name: Deploy Javascript Functions to Cloud Functions
needs: test-js
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Setup Firebase CLI
run: npm i -g firebase-tools
- name: Cache node deps
uses: actions/cache@v3
env:
cache-name: cache-node-deps
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Install deps
working-directory: ./javascript/functions/
run: npm install
- name: Deploy
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
working-directory: ./javascript/functions/
run: npx firebase deploy --only functions --token "$FIREBASE_TOKEN"
tag:
runs-on: ubuntu-latest
name: Tag as deployed
needs:
- deploy-golang-http
- deploy-golang-pubsub
- deploy-javascript
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Tag as deployed
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git tag deployed --force
git push --tags --force
- name: Google Chat Notification
uses: Co-qn/google-chat-notification@v1
with:
name: forester-func Deploy
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
if: always()