Skip to content

Commit

Permalink
change in github action flow
Browse files Browse the repository at this point in the history
  • Loading branch information
themerous committed Jul 26, 2024
1 parent 90f2c6c commit fa948d8
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,21 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install

- name: Build Next.js app
run: pnpm build

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -25,8 +39,8 @@ jobs:

- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/react-app .
docker push ${{ secrets.DOCKER_USERNAME }}/react-app
docker build -t ${{ secrets.DOCKER_USERNAME }}/react-app:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/react-app:latest
- name: SSH and deploy
uses: appleboy/ssh-action@master
Expand All @@ -35,7 +49,7 @@ jobs:
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
script: |
docker pull ${{ secrets.DOCKER_USERNAME }}/react-app
docker pull ${{ secrets.DOCKER_USERNAME }}/react-app:latest
docker stop react-app-container || true
docker rm react-app-container || true
docker run -d -p 80:3000 --name react-app-container ${{ secrets.DOCKER_USERNAME }}/react-app
docker run -d -p 80:3000 --name react-app-container ${{ secrets.DOCKER_USERNAME }}/react-app:lastest

0 comments on commit fa948d8

Please sign in to comment.