Skip to content

Commit

Permalink
Merge pull request #1582 from hngprojects/Ravencodess-patch-1
Browse files Browse the repository at this point in the history
Ravencodess patch 1
  • Loading branch information
Ravencodess authored Oct 29, 2024
2 parents 8466594 + b58bdcf commit 08971b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
33 changes: 10 additions & 23 deletions .github/workflows/production-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,29 @@ jobs:
url: ${{ vars.URL }}

steps:
- uses: actions/checkout@v4

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

- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
version: 9
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: boilerplate-build
path: .

- name: Decode and create .env file
run: |
echo ${{ secrets.ENV_BASE64 }} | base64 -d > .env
- name: Install dependencies
run: pnpm install

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

- name: Archive production artifacts
run: tar -czf nextjs-prod.tar.gz .next .env
- name: Copy to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "nextjs-prod.tar.gz"
source: ".env,boilerplate.tar.gz"
target: "~/hng_boilerplate_nextjs/prod"

- name: Delete zip file
run: rm -f nextjs-prod.tar.gz
run: rm -f boilerplate.tar.gz

- name: Deploy on server
uses: appleboy/ssh-action@master
Expand All @@ -68,7 +55,7 @@ jobs:
git stash
git reset --hard
git pull
tar -xzf nextjs-prod.tar.gz
rm -f nextjs-prod.tar.gz
tar -xzf boilerplate.tar.gz
rm -f boilerplate.tar.gz
pnpm install
pm2 restart boilerplate_fe_prod --update-env
2 changes: 1 addition & 1 deletion .github/workflows/staging-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
target: "~/hng_boilerplate_nextjs/staging"

- name: Delete zip file
run: rm -f nextjs-staging.tar.gz .env
run: rm -f boilerplate.tar.gz .env

- name: Deploy on server
uses: appleboy/ssh-action@master
Expand Down

0 comments on commit 08971b9

Please sign in to comment.