Skip to content

fix: clasp credentials saving to GITHUB_ENV #5

fix: clasp credentials saving to GITHUB_ENV

fix: clasp credentials saving to GITHUB_ENV #5

Workflow file for this run

name: Deploy Script
on:
workflow_dispatch:
push:
branches: [main, develop]
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Install clasp
id: install-clasp
run: sudo npm install @google/[email protected] -g
- name: Write CLASPRC_JSON secret to .clasp.json file
id: write-clasprc
run: echo "$CLASPRC_JSON_SECRET" >> ~/.clasp.json
env:
CLASPRC_JSON_SECRET: ${{ secrets.CLASPRC_JSON }}
- name: Check clasp login status
id: clasp_login
run: clasp login --status
- name: Save current .clasp.json contents to CLASPRC_JSON_FILE environment variable
id: save-clasprc
run: |
echo ::add-mask::$(cat ~/.clasp.json | jq -c)
echo "CLASPRC_JSON_FILE=$(cat ~/.clasp.json | jq -c)" >> $GITHUB_ENV
- name: Save CLASPRC_JSON_FILE environment variable to CLASPRC_JSON repo secret
id: set-clasprc-secret
uses: hmanzur/[email protected]
with:
name: "CLASPRC_JSON"
value: ${{ env.CLASPRC_JSON_FILE }}
repository: ${{ github.repository }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Checkout repo
id: checkout-repo
if: ${{github.event_name != 'schedule' }}
uses: actions/checkout@v4
- name: Set scriptId in .clasp.json file
id: set-script-id
if: ${{ github.event_name != 'schedule' && secrets.SCRIPT_ID }}

Check failure on line 51 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / Deploy Script

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yml (Line: 51, Col: 13): Unrecognized named-value: 'secrets'. Located at position 36 within expression: github.event_name != 'schedule' && secrets.SCRIPT_ID
run: jq '.scriptId = "${{secrets.SCRIPT_ID}}"' .clasp.json > /tmp/.clasp.json && mv /tmp/.clasp.json .clasp.json
- name: Push script to scripts.google.com
id: clasp-push
if: ${{ github.event_name != 'schedule'}}
run: clasp push -f
- name: Deploy Script
id: clasp-deploy
if: ${{env.DEPLOYMENT_ID && (github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/main'))}}
run: clasp deploy -i "$DEPLOYMENT_ID" -d "$GITHUB_REF"
env:
DEPLOYMENT_ID: ${{ secrets.DEPLOYMENT_ID }}