-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 2.35 KB
/
cd.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
name: Deploy apps script
on:
push:
paths:
- '**.js'
- '**.json'
- .github/workflows/cd.yml
branches:
- main
jobs:
deploy_job:
runs-on: ubuntu-latest
environment: deploy
timeout-minutes: 5
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
ID_TOKEN: ${{ secrets.ID_TOKEN }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
DEPLOYMENT_ID: ${{ secrets.DEPLOYMENT_ID }}
SCRIPT_ID: ${{ secrets.SCRIPT_ID }}
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Clasp
run: |
npm init -y
npm install -g @google/clasp
- name: Create clasprc.json
run: |
cat << EOS > ~/.clasprc.json
{
"token":{
"access_token":"$ACCESS_TOKEN",
"scope":"https://www.googleapis.com/auth/script.deployments https://www.googleapis.com/auth/service.management https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/drive.metadata.readonly https://www.googleapis.com/auth/script.projects https://www.googleapis.com/auth/script.webapp.deploy https://www.googleapis.com/auth/logging.read https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive.file openid",
"token_type":"Bearer",
"id_token":"$ID_TOKEN",
"expiry_date":1666457065139,
"refresh_token":"$REFRESH_TOKEN"
},
"oauth2ClientSettings":{
"clientId":"$CLIENT_ID",
"clientSecret":"$CLIENT_SECRET",
"redirectUri":"http://localhost"
},
"isLocalCreds":false
}
EOS
- name: Create .clasp.json
run: |
cat << EOS > .clasp.json
{"scriptId":"$SCRIPT_ID","rootDir":"../kzlt"}
EOS
- name: Push
run: |
clasp push -f
- name: Deploy # deploymentIdを指定する == 公開URLがかわらない
run: |
clasp deploy --deploymentId $DEPLOYMENT_ID