1.1.0 #13
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
CLASPRC_ACCESS_TOKEN: ${{ secrets.CLASPRC_ACCESS_TOKEN }} | |
CLASPRC_CLIENT_ID: ${{ secrets.CLASPRC_CLIENT_ID }} | |
CLASPRC_CLIENT_SECRET: ${{ secrets.CLASPRC_CLIENT_SECRET }} | |
CLASPRC_EXPIRY_DATE: ${{ secrets.CLASPRC_EXPIRY_DATE }} | |
CLASPRC_ID_TOKEN: ${{ secrets.CLASPRC_ID_TOKEN }} | |
CLASPRC_REFRESH_TOKEN: ${{ secrets.CLASPRC_REFRESH_TOKEN }} | |
CLASP_SCRIPT_ID: ${{ secrets.CLASP_SCRIPT_ID }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Cache node modules | |
uses: actions/[email protected] | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Create ~/.clasprc.json | |
run: | | |
echo $(cat <<-EOS | |
{ | |
"token": { | |
"access_token": "${CLASPRC_ACCESS_TOKEN}", | |
"scope": "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/script.projects https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/service.management https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/script.webapp.deploy openid https://www.googleapis.com/auth/script.deployments https://www.googleapis.com/auth/logging.read https://www.googleapis.com/auth/drive.metadata.readonly", | |
"token_type": "Bearer", | |
"id_token": "${CLASPRC_ID_TOKEN}", | |
"expiry_date": ${CLASPRC_EXPIRY_DATE}, | |
"refresh_token": "${CLASPRC_REFRESH_TOKEN}" | |
}, | |
"oauth2ClientSettings": { | |
"clientId": "${CLASPRC_CLIENT_ID}", | |
"clientSecret": "${CLASPRC_CLIENT_SECRET}", | |
"redirectUri": "http://localhost" | |
}, | |
"isLocalCreds": false | |
} | |
EOS | |
) > ~/.clasprc.json | |
- name: Create ~/.clasp.json | |
run: | | |
echo $(cat <<-EOS | |
{ | |
"scriptId": "${CLASP_SCRIPT_ID}", | |
"rootDir": "./src" | |
} | |
EOS | |
) > ./.clasp.json | |
- name: Get version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Upload files | |
run: npx @google/clasp push --force | |
- name: Deploy | |
run: npx @google/clasp deploy -d ${{ steps.get_version.outputs.VERSION }} |