Skip to content

Commit

Permalink
Update production-deployment.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Ravencodess <[email protected]>
  • Loading branch information
Ravencodess authored Sep 13, 2024
1 parent 77ea214 commit 2ee510e
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/production-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ name: Production Deployment

on:
workflow_dispatch:
push:
workflow_run:
workflows: ["Build and Upload"]
types:
- completed
branches:
- main
paths-ignore:
- .github/workflows/**

jobs:
build:
runs-on: ubuntu-latest

if: ${{ github.ref == 'refs/heads/main'}} && ${{ github.event.workflow_run.conclusion == 'success' }}

environment:
name: "production"
url: ${{ vars.URL }}

steps:
- uses: actions/checkout@v4

Expand All @@ -20,14 +26,6 @@ jobs:
with:
node-version: "20"

- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
Expand All @@ -53,7 +51,7 @@ jobs:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "nextjs-prod.tar.gz"
target: "~/hng_boilerplate_nextjs"
target: "~/hng_boilerplate_nextjs/prod"

- name: Delete zip file
run: rm -f nextjs-prod.tar.gz
Expand All @@ -65,7 +63,7 @@ jobs:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd ~/hng_boilerplate_nextjs
cd ~/hng_boilerplate_nextjs/prod
tar -xzf nextjs-prod.tar.gz
rm -f nextjs-prod.tar.gz
cp -r .next/standalone/* .
Expand Down

0 comments on commit 2ee510e

Please sign in to comment.