Add environment to release action #2
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 Server | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: release | |
steps: | |
- name: Checkout Repository | |
uses: actions/[email protected] | |
- name: Install Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: '20' | |
- name: Install Dependencies | |
run: npm install | |
- name: Build React App | |
run: npm run build | |
- name: Configure SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Deploy via SSH | |
run: | | |
scp -r ./dist/* [email protected]:~/project/areyouhere-web | |
- name: Restart Nginx | |
run: | | |
ssh [email protected] 'sudo systemctl restart nginx' |