Skip to content

ログを吐く

ログを吐く #27

Workflow file for this run

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