Update Phone Number #28
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: NPH Digital Deployment | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - nphdigital.vn | |
| jobs: | |
| merge-and-deploy: | |
| if: github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.TOKEN }} | |
| - name: Merge and Deploy | |
| run: | | |
| # Cấu hình git | |
| git config --global user.name 'GitHub Actions' | |
| git config --global user.email 'actions@github.com' | |
| # Merge master vào nphdigital.vn | |
| echo "🔄 Merging master into nphdigital.vn..." | |
| git fetch origin | |
| git checkout nphdigital.vn | |
| git pull origin nphdigital.vn | |
| if ! git merge origin/master -m "Auto-merge master into nphdigital.vn"; then | |
| echo "⚠️ Conflicts detected, resolving with master changes..." | |
| git checkout --ours . | |
| git add . | |
| git commit -m "Resolve conflicts with master changes" | |
| fi | |
| git push origin nphdigital.vn | |
| echo "✅ Merge completed successfully" | |
| - name: Deploy to Both Domains | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| password: ${{ secrets.PASSWORD }} | |
| port: 22 | |
| script: | | |
| # Deploy nphdigital.com | |
| echo "🚀 Deploying nphdigital.com..." | |
| cd /var/www/nphdigital/nphdigital.com/nphdigital | |
| echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S git pull origin master | |
| echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S npm run build | |
| pm2 reload 0 | |
| pm2 restart 0 | |
| # Deploy nphdigital.vn | |
| echo "🚀 Deploying nphdigital.vn..." | |
| cd /var/www/nphdigital/nphdigital.vn/nphdigitalvn | |
| echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S git pull origin nphdigital.vn | |
| echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S npm run build | |
| pm2 reload 1 | |
| pm2 restart 1 | |
| deploy-vn-only: | |
| if: github.ref == 'refs/heads/nphdigital.vn' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy nphdigital.vn | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| password: ${{ secrets.PASSWORD }} | |
| port: 22 | |
| script: | | |
| echo "🚀 Deploying nphdigital.vn..." | |
| cd /var/www/nphdigital/nphdigital.vn/nphdigitalvn | |
| echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S git pull origin nphdigital.vn | |
| echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S npm run build | |
| pm2 reload 1 | |
| pm2 restart 1 |