Skip to content

Commit

Permalink
Merge pull request #5 from mikedownesdev/test
Browse files Browse the repository at this point in the history
First Prod Merge
  • Loading branch information
mikedownesdev authored Sep 6, 2023
2 parents d80a333 + 6d1cb7e commit e791395
Show file tree
Hide file tree
Showing 54 changed files with 1,738 additions and 954 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/prod-env-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Prod Env Deploy Script

on:
workflow_dispatch:
push:
branches: [main]

jobs:
build_and_deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Install clasp
id: install-clasp
run: sudo npm install @google/clasp@2.4.1 -g

- name: Write CLASPRC_JSON secret to .clasprc.json file
id: write-clasprc
run: echo "$CLASPRC_JSON_SECRET" >> ~/.clasprc.json
env:
CLASPRC_JSON_SECRET: ${{ secrets.CLASPRC_JSON }}

- name: Check clasp login status
id: clasp_login
run: clasp login --status

- name: Save current .clasprc.json contents to CLASPRC_JSON_FILE environment variable
id: save-clasprc
run: |
echo ::add-mask::$(tr -d '\n\r' < ~/.clasprc.json)
echo "CLASPRC_JSON_FILE=$(tr -d '\n\r' < ~/.clasprc.json)" >> $GITHUB_ENV
- name: Save CLASPRC_JSON_FILE environment variable to CLASPRC_JSON repo secret
id: set-clasprc-secret
if: ${{ env.CLASPRC_JSON_FILE != env.CLASPRC_JSON_SECRET }}
uses: hmanzur/actions-set-secret@v2.0.0
env:
CLASPRC_JSON_SECRET: ${{ secrets.CLASPRC_JSON }}
with:
name: "CLASPRC_JSON"
value: ${{ env.CLASPRC_JSON_FILE }}
repository: ${{ github.repository }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}

- name: Set scriptId in .clasp.json file
id: set-script-id
run: jq '.scriptId = "${{env.PROD_SCRIPT_ID}}"' .clasp.json > /tmp/.clasp.json && mv /tmp/.clasp.json .clasp.json
env:
TEST_SCRIPT_ID: ${{secrets.PROD_SCRIPT_ID}}

## Build & push

- name: Build project
run: npm run build

- name: Push script to scripts.google.com
id: clasp-push
run: clasp push -f

- name: Deploy Script
id: clasp-deploy
if: github.ref == 'refs/heads/test'
run: clasp deploy -i "${{ secrets.PROD_DEPLOYMENT_ID }}" -d ${{github.run_number}}
env:
TEST_SCRIPT_ID: ${{ secrets.PROD_SCRIPT_ID }}
12 changes: 6 additions & 6 deletions .github/workflows/test-env-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ jobs:
id: clasp-push
run: clasp push -f

# - name: Deploy Script
# id: clasp-deploy
# if: ${{env.TEST_DEPLOYMENT_ID && (github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/develop'))}}
# run: clasp deploy -i "$TEST_DEPLOYMENT_ID" -d ${{github.run_number}}
# env:
# TEST_SCRIPT_ID: ${{ secrets.TEST_SCRIPT_ID }}
- name: Deploy Script
id: clasp-deploy
if: github.ref == 'refs/heads/test'
run: clasp deploy -i "${{ secrets.TEST_DEPLOYMENT_ID }}" -d ${{github.run_number}}
env:
TEST_SCRIPT_ID: ${{ secrets.TEST_SCRIPT_ID }}
7 changes: 2 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
<script type="module">
import { navigate } from "svelte-routing";
// This is necessary to load the homepage when the app is deployed to Google Apps Script
if (window.location.pathname !== '/') {
// window.location.pathname = '/'
console.log('navigating to home')
navigate('/', { replace: true })
}
console.log('navigating to home')
navigate('/', { replace: true })
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
* Use global.d.ts instead of compilerOptions.types
* to avoid limiting type declarations.
*/
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
}
Loading

0 comments on commit e791395

Please sign in to comment.