Skip to content

Commit

Permalink
added deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
eneoli committed Sep 5, 2024
1 parent 8f5fc91 commit b8e87a2
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy

on:
pull_request:
types: [ closed ]
branches:
- release

jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
environment: Deployment
steps:
- uses: actions/checkout@v4
- run: npm install
- run: ./deploy.sh
env:
BUILD_MODE: ${{ vars.BUILD_MODE }}
DEPLOYMENT_RES_PATH: ${{ vars.DEPLOYMENT_RES_PATH }}
DEPLOYMENT_SERVER: ${{ vars.DEPLOYMENT_SERVER }}
DEPLOYMENT_USER: ${{ vars.DEPLOYMENT_USER }}
SSH_KEY: ${{ secrets.SSH_KEY }}
32 changes: 32 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -e

SCRIPT_DIR=$(pwd)
ROOT_DIR=$SCRIPT_DIR
BUILD_DIR=$SCRIPT_DIR/dist

echo "==== Alice Deployment ===="
echo ""
echo "--> Compiling WASM binary..."
echo ""

wasm-pack build

echo ""
echo "--> Compiling frontend..."
echo ""

npm run build:$BUILD_MODE

echo ""
echo "--> Uploading to deployment server..."
echo ""

ssh-add - <<< "${SSH_KEY}"
ssh $DEPLOYMENT_USER@$DEPLOYMENT_SERVER "rm -rf $DEPLOYMENT_RES_PATH/*"
scp -r dist $DEPLOYMENT_USER@$DEPLOYMENT_SERVER:$DEPLOYMENT_RES_PATH

echo -e "\033[1;32m"
echo "Done ^-^"
echo -e "\033[0m"

0 comments on commit b8e87a2

Please sign in to comment.