diff --git a/.github/workflows/production-deployment.yml b/.github/workflows/production-deployment.yml index 270e223bc..d3d9371b6 100644 --- a/.github/workflows/production-deployment.yml +++ b/.github/workflows/production-deployment.yml @@ -19,30 +19,17 @@ 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 @@ -50,11 +37,11 @@ jobs: 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 @@ -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 diff --git a/.github/workflows/staging-deployment.yml b/.github/workflows/staging-deployment.yml index 0809ac44b..f2e880bc1 100644 --- a/.github/workflows/staging-deployment.yml +++ b/.github/workflows/staging-deployment.yml @@ -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