Test ci cd #2
This file contains hidden or 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 CMS Undershows | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout 🛎️ | |
| uses: actions/checkout@v3 | |
| - name: Install SSH Client | |
| run: sudo apt-get update && sudo apt-get install -y openssh-client | |
| - name: Setup SSH Key 🔐 | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_KEY }}" > ~/.ssh/deploy_key | |
| chmod 600 ~/.ssh/deploy_key | |
| cat >> ~/.ssh/config << EOF | |
| Host server | |
| HostName ${{ secrets.SSH_HOST }} | |
| User ${{ secrets.SSH_USER }} | |
| IdentityFile ~/.ssh/deploy_key | |
| StrictHostKeyChecking no | |
| EOF | |
| - name: Deploy to Server 🚀 | |
| run: | | |
| ssh server << 'EOF' | |
| cd /var/www/cms/ | |
| export NODE_OPTIONS="--max_old_space_size=2048" | |
| yarn install | |
| yarn build | |
| pm2 restart 1337-cms.undershows.com.br | |
| chown -R www-data:www-data /var/www/cms/ | |
| EOF | |