-
Notifications
You must be signed in to change notification settings - Fork 15
54 lines (51 loc) · 1.71 KB
/
cloud-function-deploy.yml
File metadata and controls
54 lines (51 loc) · 1.71 KB
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
name: cloud-function-deploy
on:
workflow_call:
workflow_dispatch:
push:
branches: [main]
paths:
- 'function/**'
- '.github/workflows/cloud-function-deploy.yml'
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./function
steps:
- uses: actions/checkout@v2
- run: mkdir -p /home/runner/.npm
continue-on-error: true
- name: Use Node.js 12
uses: actions/setup-node@v2
with:
node-version: 12
cache: 'npm'
cache-dependency-path: function/package-lock.json
# setting https://github.com/serverless/serverless-tencent/issues/142
- name: echo >.env
run: >
echo 'SLS_GEO_LOCATION=cn serverless deploy'>./.env
&& echo 'SERVERLESS_PLATFORM_VENDOR=tencent'>>./.env && cat ./.env
&& echo 'SEVER_GOOGLE_ANALYTICS_KEY=${{ secrets.SEVER_GOOGLE_ANALYTICS_KEY }}'>>./.env
&& echo 'ETHERSCAN_API_KEY=${{ secrets.ETHERSCAN_API_KEY }}'>>./.env
- name: npm install
run: npm install
- name: npm install serverless
run: npm i -g serverless serverless-tencent
- name: install typescript
run: npm install -g typescript
- name: login with key
run: serverless credentials set --secretId ${{ secrets.TENCENT_SECRET_ID }} --secretKey ${{ secrets.TENCENT_SECRET_KEY }}
- name: build
run: npm run build
- name: deploy
run: sls deploy
- name: depoly fail
if: failure()
run: |
curl -X POST -H 'Content-Type:Application/json' \
-d '{"msg_type":"text","content":{"text":"MetaShield depoly fail"}}' \
https://open.feishu.cn/open-apis/bot/v2/hook/59b87f3a-c36f-41de-9900-853a802dce1f