Skip to content

Commit

Permalink
add STAGING deploy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed Mar 18, 2024
1 parent e7e95fb commit 8ad83ba
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/workflows/deploy_staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy STAGING to Google Apps Script

on:
push:
branches:
- staging

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18"

- name: Install dependencies
run: |
cd media_commons_booking_app
npm ci
- name: Set up clasp authentication
run: |
echo "$CLASP_CREDENTIALS" > ~/.clasprc.json
env:
CLASP_CREDENTIALS: ${{ secrets.CLASP_CREDENTIALS }}
- name: Install clasp
run: npm install -g @google/clasp
- name: Push to Google Apps Script
run: |
cd media_commons_booking_app
npm run deploy:staging
- name: Create new version and push
run: |
cd media_commons_booking_app
clasp deploy --deploymentId AKfycbxviocXzB4aOPCV5XuxNGX4vWNsK4pHwm88sJIKpHBlUKPDsGe2Ca3IA-09rgc2BzXzhA -d "STAGING"
2 changes: 2 additions & 0 deletions media_commons_booking_app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
"open": "clasp open --addon",
"setup:https": "mkdirp certs && mkcert -key-file ./certs/key.pem -cert-file ./certs/cert.pem localhost 127.0.0.1",
"build:dev": "cross-env NODE_ENV=development webpack",
"build:staging": "cross-env NODE_ENV=staging webpack",
"build": "cross-env NODE_ENV=production webpack",
"deploy:dev": "rimraf dist && npm run build:dev && npx clasp push",
"deploy:staging": "rimraf dist && npm run build:staging && npx clasp push",
"deploy": "rimraf dist && npm run build && npx clasp push",
"serve": "cross-env NODE_ENV=development webpack serve",
"start": "npm run deploy:dev && npm run serve"
Expand Down
3 changes: 2 additions & 1 deletion media_commons_booking_app/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const PORT = envVars.PORT || 3000;
envVars.NODE_ENV = process.env.NODE_ENV;
envVars.PORT = PORT;

const isProd = process.env.NODE_ENV === 'production';
const isProd =
process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'staging';
const isWebpackServe = process.env.WEBPACK_SERVE === 'true';

const publicPath = process.env.ASSET_PATH || '/';
Expand Down

0 comments on commit 8ad83ba

Please sign in to comment.