Skip to content

Commit

Permalink
Merge pull request #276 from 0xsend/dev
Browse files Browse the repository at this point in the history
first deploy
  • Loading branch information
0xBigBoss authored Apr 6, 2024
2 parents ba79e31 + fbf718a commit cf1e7e3
Show file tree
Hide file tree
Showing 470 changed files with 30,568 additions and 18,857 deletions.
5 changes: 4 additions & 1 deletion .env.local.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ SUPABASE_DB_URL=postgresql://postgres:postgres@localhost:54322/postgres
SUPABASE_SERVICE_ROLE=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
SUPABASE_JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long
NEXT_PUBLIC_MAINNET_CHAIN_ID=1337
NEXT_PUBLIC_BASE_MAINNET_CHAIN_ID=845337
NEXT_PUBLIC_BASE_CHAIN_ID=845337
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=33fe0df7cd4f445f4e2ba7e0fd6ed314
SNAPLET_HASH_KEY=sendapp
SEND_ACCOUNT_FACTORY_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
SECRET_SHOP_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
17 changes: 17 additions & 0 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ inputs:
supabase-db-password:
description: "The Supabase database password to use for deployment."
required: true
qa-notification-url:
description: "The URL to use for notifying QA of a new deployment."
required: false
default: ""
runs:
using: "composite"
steps:
Expand All @@ -47,6 +51,7 @@ runs:
id: public-hostname
run: echo "public-hostname=sendapp-${{steps.extract-branch.outputs.branch}}-0xsend.vercel.app" >> $GITHUB_OUTPUT
- name: Vercel Deploy
id: vercel-deploy
uses: ./.github/actions/vercel-deploy
with:
vercel-token: ${{ inputs.vercel-token }}
Expand All @@ -56,3 +61,15 @@ runs:
production: ${{ inputs.production }}
env:
YARN_ENABLE_HARDENED_MODE: "0"
- name: Notify QA
if: ${{ inputs.qa-notification-url != '' }}
shell: bash
run: |
sha=$(git rev-parse HEAD | cut -c1-7)
summary=$(git log -1 --pretty=%B | head -n 1)
if [ "${{ inputs.production }}" = "true" ]; then
data=$(printf "New production deployment is available. Summary: %s %s\n\nUnique URL: %s\n\nPublic Hostname: %s" "$summary" "$sha" "${{ steps.vercel-deploy.outputs.deployment-url }}" "https://${{ steps.public-hostname.outputs.public-hostname }}")
else
data=$(printf "New staging deployment is available. Summary: %s %s\n\nUnique URL: %s\n\nPublic Hostname: %s" "$summary" "$sha" "${{ steps.vercel-deploy.outputs.deployment-url }}" "https://${{ steps.public-hostname.outputs.public-hostname }}")
fi
curl -X POST -d "$data" "${{ inputs.qa-notification-url }}"
8 changes: 8 additions & 0 deletions .github/actions/install-tilt/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: "Install Tilt"
runs:
using: "composite"
steps:
- name: Install Tilt
id: tilt
shell: bash
run: curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash
17 changes: 17 additions & 0 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
description: "Whether to run Yarn install."
required: false
default: "true"
build-nextjs:
description: "Whether to build Next.js."
required: false
default: "false"
runs:
using: "composite"
steps:
Expand All @@ -38,3 +42,16 @@ runs:
if: ${{ inputs.yarn-install == 'true' }}
shell: bash
run: yarn install --immutable
- name: Build Next.js
if: ${{ inputs.build-nextjs == 'true' }}
shell: bash
run: |
cp .env.local.template .env.local
yarn web:prod
rm .env.local
- name: Save Next.js
if: ${{ inputs.build-nextjs == 'true' }}
uses: actions/upload-artifact@v4
with:
name: nextjs-build
path: ${{ github.workspace }}/apps/next/.next/
93 changes: 75 additions & 18 deletions .github/actions/vercel-deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ inputs:
vercel-project-id:
description: "The Vercel project ID to use for deployment."
required: true
vercel-scope:
description: "The Vercel scope to use for deployment."
required: false
default: "0xsend"
deploy-preview-extra-args:
description: "The Vercel extra args to add to the deploy preview command. e.g. '-e NODE_ENV=production -e API_URL=https://api.example.com'"
required: false
default: ""
public-hostname:
description: "The public hostname alias to use for the deployment."
required: false
Expand All @@ -21,51 +29,100 @@ inputs:
outputs:
deployment-url:
description: "The URL of the deployment."
value: ${{ steps.deploy.outputs.deployment_url }}
value: ${{ steps.deploy-preview.outputs.deployment_url }}
runs:
using: "composite"
steps:
- name: Mask Vercel Token
shell: bash
run: echo "::add-mask::${{ inputs.vercel-token }}"
- name: Switch to Vercel Send team
run: |
echo "::add-mask::${{ inputs.vercel-token }}"
- name: Switch to Vercel team
shell: bash
run: bunx vercel --token=${{ inputs.vercel-token }} team switch ${{ inputs.vercel-scope }}
env:
VERCEL_ORG_ID: ${{ inputs.vercel-org-id }}
VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }}
# BEGIN Preview Environment
- name: Setup Preview Environment
if: ${{ inputs.production != 'true' }}
shell: bash
run: |
bunx vercel --token=${{ inputs.vercel-token }} -S ${{ inputs.vercel-scope }} pull --yes --environment=preview
cp .vercel/.env.preview.local .env.local
env:
VERCEL_ORG_ID: ${{ inputs.vercel-org-id }}
VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }}
- name: Build Preview Project Artifacts
if: ${{ inputs.production != 'true' }}
shell: bash
run: bunx vercel --token=${{ inputs.vercel-token }} team switch 0xsend
run: bunx vercel --token=${{ inputs.vercel-token }} -S ${{ inputs.vercel-scope }} build
env:
VERCEL_ORG_ID: ${{ inputs.vercel-org-id }}
VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }}
- name: Pull Vercel Environment Information
- name: Deploy Preview
if: ${{ inputs.production != 'true' }}
id: deploy-preview
shell: bash
run: bunx vercel --token=${{ inputs.vercel-token }} pull --yes --environment=preview
run: |
bunx vercel --token=${{ inputs.vercel-token }} -S ${{ inputs.vercel-scope }} deploy --prebuilt ${{inputs.deploy-preview-extra-args}} > deployment-url.txt
echo "deployment_url=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT
echo ::notice::Deployment URL: $(cat deployment-url.txt)
env:
VERCEL_ORG_ID: ${{ inputs.vercel-org-id }}
VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }}
VERCEL_GIT_COMMIT_SHA: ${{ github.sha }}
VERCEL_GIT_COMMIT_REF: ${{ github.head_ref }}
VERCEL_GIT_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
- name: Set Deploy Preview Vercel Branch Alias
if: ${{ inputs.public-hostname != '' && inputs.production != 'true'}}
shell: bash
run: |
bunx vercel --token=${{ inputs.vercel-token }} -S ${{ inputs.vercel-scope }} alias set ${{ steps.deploy-preview.outputs.deployment_url }} ${{ inputs.public-hostname }}
echo ::notice::Vercel Alias URL https://${{ inputs.public-hostname }}/
env:
VERCEL_ORG_ID: ${{ inputs.vercel-org-id }}
VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }}
# END Preview Environment

# BEGIN Production Environment
- name: Setup Production Environment
if: ${{ inputs.production == 'true' }}
shell: bash
run: |
bunx vercel --token=${{ inputs.vercel-token }} -S ${{ inputs.vercel-scope }} pull --yes --environment=production
cp .vercel/.env.production.local .env.local
env:
VERCEL_ORG_ID: ${{ inputs.vercel-org-id }}
VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }}
- name: Build Project Artifacts
- name: Build Production Project Artifacts
if: ${{ inputs.production == 'true' }}
shell: bash
run: bunx vercel --token=${{ inputs.vercel-token }} build
run: bunx vercel --token=${{ inputs.vercel-token }} -S ${{ inputs.vercel-scope }} build --prod
env:
VERCEL_ORG_ID: ${{ inputs.vercel-org-id }}
VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }}
- name: Deploy Project Artifacts to Vercel
id: deploy
- name: Deploy Production
if: ${{ inputs.production == 'true' }}
id: deploy-prod
shell: bash
run: |
if [[ ${{ inputs.production }} == "true" ]]; then
bunx vercel --token=${{ inputs.vercel-token }} deploy --prebuilt --prod > deployment-url.txt
else
bunx vercel --token=${{ inputs.vercel-token }} deploy --prebuilt > deployment-url.txt
fi
bunx vercel --token=${{ inputs.vercel-token }} -S ${{ inputs.vercel-scope }} deploy --prebuilt --prod > deployment-url.txt
echo "deployment_url=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT
echo ::notice::Deployment URL: $(cat deployment-url.txt)
env:
VERCEL_ORG_ID: ${{ inputs.vercel-org-id }}
VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }}
- name: Set Vercel Branch Alias
if: ${{ inputs.public-hostname != '' }}
VERCEL_GIT_COMMIT_SHA: ${{ github.sha }}
VERCEL_GIT_COMMIT_REF: ${{ github.head_ref }}
VERCEL_GIT_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
- name: Set Deploy Production Vercel Branch Alias
if: ${{ inputs.public-hostname != '' && inputs.production == 'true'}}
shell: bash
run: |
bunx vercel --token=${{ inputs.vercel-token }} -S 0xsend alias set ${{ steps.deploy.outputs.deployment_url }} ${{ inputs.public-hostname }}
bunx vercel --token=${{ inputs.vercel-token }} -S ${{ inputs.vercel-scope }} alias set ${{ steps.deploy-prod.outputs.deployment_url }} ${{ inputs.public-hostname }}
echo ::notice::Vercel Alias URL https://${{ inputs.public-hostname }}/
env:
VERCEL_ORG_ID: ${{ inputs.vercel-org-id }}
VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }}
# END Production Environment
Loading

0 comments on commit cf1e7e3

Please sign in to comment.