-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1202 from hngprojects/dev
update deployment workflow
- Loading branch information
Showing
5 changed files
with
40 additions
and
21,364 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,58 @@ | ||
name: Production Deployment | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
deploy-prod: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name : Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
|
||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Build Application | ||
run: | | ||
npm run build | ||
cp package.json deployment.sh main-ecosystem-config.json dist | ||
- name: Archive application build | ||
run: | | ||
tar -czf nestjs.tar.gz dist | ||
- name: Copy Artifacts to server | ||
run: | | ||
sshpass -p ${{ secrets.PASSWORD }} scp -o StrictHostKeyChecking=no nestjs.tar.gz ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/tmp/nestjs | ||
rm -f nestjs.tar.gz | ||
- name: Deploy on server | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
cd main | ||
cd backend/nestjs | ||
tar -xzf /tmp/nestjs/nestjs.tar.gz -C . | ||
rm -f /tmp/nestjs/nestjs.tar.gz | ||
mv dist/package.json . | ||
mv dist/main-ecosystem-config.json . | ||
mv dist/deployment.sh . | ||
chmod +x deployment.sh | ||
./deployment.sh main | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.