-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from mikedownesdev/test
First Prod Merge
- Loading branch information
Showing
54 changed files
with
1,738 additions
and
954 deletions.
There are no files selected for viewing
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
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 }} |
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
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
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
Oops, something went wrong.