added new endpoints and updated readme file #23
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 build to AzureVM | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build the React app | |
run: | | |
CI=false | |
npm run build | |
- name: Create SSH key file | |
run: | | |
mkdir -p /home/runner/.ssh | |
echo "${{ secrets.KEY }}" > /home/runner/.ssh/id_rsa | |
chmod 600 /home/runner/.ssh/id_rsa | |
- name: Configure SSH | |
run: | | |
echo "Host ${{ secrets.HOST }}" > /home/runner/.ssh/config | |
echo " StrictHostKeyChecking no" >> /home/runner/.ssh/config | |
- name: Copy build files to AzureVM | |
run: | | |
scp -i /home/runner/.ssh/id_rsa -r build/* ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/home/azureuser/server/static_healthcare/ | |
- name: Deploy to VM | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
script: | | |
cd /home/azureuser/server/ | |
# start nginx with new build files | |
sudo docker rm -f nginx | |
sudo docker-compose up -d | |
sudo docker exec nginx nginx -s reload |