Skip to content

Commit

Permalink
enh: full-stack preview app enhancements (#317)
Browse files Browse the repository at this point in the history
* refactor: change `SS_STAGE` to `SST_STAGE`

* deps: use latest stable release of sst

sst v3 is now a stable release. this removes the need for the go binary
install step. npm wins, yet again

* fix: fix lint, prettier issues

* refactor: remove redundant `default_app` directory

---------

Co-authored-by: Barnabas A Nsoh <[email protected]>
  • Loading branch information
tamssokari and ayinloya authored Sep 5, 2024
1 parent ecde744 commit 95124d6
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 254 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,28 @@ jobs:
with:
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }}
aws-region: ${{ secrets.AWS_REGION }}
- name: install sst
run: |
curl -fsSL https://ion.sst.dev/install | VERSION=0.1.51 bash
- name: set sst stage
id: get_branch_name
run: |
BRANCH_NAME=${{ github.event.pull_request.head.ref }}
SANITIZED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9]/-/g')
echo "SS_STAGE=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
echo "SST_STAGE=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT
- name: install dependencies
run: npm install
- name: build application
run: npm run build
- name: configure sst secrets
run: |
sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} --stage ${{ steps.get_branch_name.outputs.SS_STAGE }} &&
sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} --stage ${{ steps.get_branch_name.outputs.SS_STAGE }} &&
sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} --stage ${{ steps.get_branch_name.outputs.SS_STAGE }} &&
sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} --stage ${{ steps.get_branch_name.outputs.SS_STAGE }}
sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} --stage ${{ steps.get_branch_name.outputs.SST_STAGE }}
- name: deploy sst app
if: github.event.pull_request.merged != true
id: deploy_sst_app
run: |
sst deploy --stage=${{ steps.get_branch_name.outputs.SS_STAGE }}
sst deploy --stage=${{ steps.get_branch_name.outputs.SST_STAGE }}
- name: remove sst app
if: github.event.pull_request.merged == true
run: |
sst remove --stage=${{ steps.get_branch_name.outputs.SS_STAGE }}
sst remove --stage=${{ steps.get_branch_name.outputs.SST_STAGE }}
6 changes: 3 additions & 3 deletions previews/app/routes/products.$productName.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { LoaderFunctionArgs } from '@remix-run/node';
import { useLoaderData } from '@remix-run/react';
import { useState, useEffect } from 'react';
import { useState } from 'react';
import { Resource } from 'sst';
import products from '~/data/products.json';

declare global {
interface Window {
SmileIdentity: Function;
SmileIdentity: function;
}
}

Expand Down Expand Up @@ -83,7 +83,7 @@ export default function Product() {
...config,
document_ids: [config.document_id],
document_capture_modes: (
(config.document_capture_modes as String) ?? ''
(config.document_capture_modes as string) ?? ''
).split(','),
partner_details: {
partner_id: config.partner_id,
Expand Down
18 changes: 0 additions & 18 deletions previews/default_app/entry.client.tsx

This file was deleted.

140 changes: 0 additions & 140 deletions previews/default_app/entry.server.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions previews/default_app/root.tsx

This file was deleted.

41 changes: 0 additions & 41 deletions previews/default_app/routes/_index.tsx

This file was deleted.

Loading

0 comments on commit 95124d6

Please sign in to comment.