Merge pull request #85 from biothings/andrewsu-patch-1 #24
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
name: Deploy-to-EC2-Prod | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
name: Deploy to EC2 on add-github-actions-deployment branch push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Step 0 - Install APT Dependences | |
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev libxmlsec1-dev libxmlsec1-openssl libxml2 libxmlsec1 pkg-config | |
- name: Step 1 - Checkout the Files | |
uses: actions/checkout@v3 | |
- name: Step 2 - Install Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '19.7.0' | |
- name: Step 3 - Build Frontend | |
run: | | |
npm install | |
NODE_OPTIONS="--max-old-space-size=1512 --openssl-legacy-provider" CI=false npm run build | |
- name: Step 4 - Deploy to Server | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SOURCE: "/build/" | |
SSH_PRIVATE_KEY: ${{ secrets.AWS_PROD_EC2_SSH_KEY }} | |
REMOTE_HOST: ${{ secrets.AWS_PROD_HOST_DNS }} | |
REMOTE_USER: ${{ secrets.AWS_PROD_USERNAME }} | |
TARGET: ${{ secrets.AWS_PROD_TARGET_DIR }} | |
SCRIPT_AFTER: | | |
set -x | |
echo "Restarting nginx service..." | |
sudo systemctl restart nginx | |
set +x | |
echo $RSYNC_STDOUT | |
# - name: Setup tmate debug session on failure | |
# if: ${{ failure() }} | |
# uses: mxschmitt/action-tmate@v3 |