Dark mode #7
Workflow file for this run
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 Demo Server | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm install | |
- name: Create Custom Config File | |
run: echo '${{ secrets.CUSTOM_CONFIG_JSON }}' > src/config.json | |
- name: Build Project | |
run: npm run build | |
- name: Setup SSH Key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key | |
chmod 600 ~/.ssh/deploy_key | |
ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts | |
- name: Upload artifact via SCP | |
run: | | |
scp -i ~/.ssh/deploy_key -r ./build/* ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:/home/opc/build | |
- name: Move to Nginx Folder | |
run: | | |
ssh -i ~/.ssh/deploy_key ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} << 'EOF' | |
sudo cp -r /home/opc/build/* /usr/share/nginx/html/ | |
rm -rf /home/opc/build | |
EOF |