Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge to main #1583

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
33 changes: 10 additions & 23 deletions .github/workflows/staging-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,30 @@ 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-staging.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-staging.tar.gz"
source: ".env,boilerplate.tar.gz"
target: "~/hng_boilerplate_nextjs/staging"

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

- name: Deploy on server
uses: appleboy/ssh-action@master
Expand All @@ -68,7 +56,6 @@ jobs:
git stash
git reset --hard
git pull
tar -xzf nextjs-staging.tar.gz
rm -f nextjs-staging.tar.gz
pnpm install
tar -xzf boilerplate.tar.gz
rm -f boilerplate.tar.gz
pm2 restart boilerplate_fe_staging --update-env
Loading