-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (39 loc) · 1.27 KB
/
main.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
name: Node.js CI
on:
workflow_dispatch:
pull_request:
push:
branches: [ master ]
jobs:
deploy:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v2
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: 'projects/391399927959/locations/global/workloadIdentityPools/github-actions-taichunmin-pools/providers/github-actions-provider'
service_account: 'gcf-line-devbot@taichunmin.iam.gserviceaccount.com'
# https://github.com/google-github-actions/setup-gcloud
# https://github.com/google-github-actions/auth#setting-up-workload-identity-federation
- name: 設定 Google Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
install_components: 'beta'
- name: 確認 Google Cloud SDK
run: gcloud info
- name: 建立 GCF 環境變數檔案
shell: bash
run: |
[[ -z "$ENV_PROD" ]] || echo "$ENV_PROD" > .env.yaml
echo "GITHUB_SHA: ${GITHUB_SHA}" >> .env.yaml
env:
ENV_PROD: ${{ secrets.ENV_PROD }}
- name: 安裝相依性套件
run: yarn
- name: 部署到 Google Cloud Functions
run: yarn deploy