Added hint on start button #8
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the latest commit | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Install Node.js and switch to version 20 | |
- name: Install Node.js | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash | |
source ~/.nvm/nvm.sh | |
nvm install 20 | |
nvm use 20 | |
node -v | |
# Install PM2 | |
- name: Install PM2 globally | |
run: | | |
npm install pm2 -g | |
# Set up SSH access | |
- name: Set up SSH | |
uses: webfactory/ssh-agent@v0.7.0 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
# Deploy to the server | |
- name: Deploy to server | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF' | |
source ~/.nvm/nvm.sh | |
nvm use 20 | |
cd ${{ secrets.PROJECT_DIR }} | |
git pull origin main | |
yarn install | |
yarn test:unit || echo "No tests found" | |
yarn build | |
pm2 restart introvue || pm2 start "yarn preview --host" --name "introvue" | |
EOF |