Update README.md #64
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: Next.js CI/CD | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
- name: create .env file | |
shell: bash | |
run: | | |
touch .env | |
echo "${{secrets.env}}" > .env | |
- name: Install and Build 🔧 | |
run: | | |
yarn install | |
yarn build | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: connect EC2 instance, Pull recent version of GitHub and start yarn | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.AWS_EC2_HOST_IP }} | |
username: ${{ secrets.AWS_EC2_USERNAME }} | |
key: ${{ secrets.AWS_SSH_KEY }} | |
port: 22 | |
script: | | |
pm2 stop yarn | |
pm2 delete yarn | |
cd /home/ubuntu | |
rm -rf Menjil-FE | |
git clone https://github.com/Menjil-Menjil/Menjil-FE.git | |
cd Menjil-FE | |
touch .env | |
echo "${{secrets.env}}" > .env | |
yarn install | |
yarn build | |
pm2 start yarn -- start | |
# sudo docker-compose down | |
# sudo docker system prune -a -f | |
# sudo docker-compose up -d | |