Skip to content

Merge pull request #34 from smswithoutborders/staging #11

Merge pull request #34 from smswithoutborders/staging

Merge pull request #34 from smswithoutborders/staging #11

Workflow file for this run

name: πŸš€ Deploy SMSWithoutBorders Blog on Server (production)
on:
push:
branches:
- main
jobs:
deploy:
name: πŸš€ Execute Deployment Script on Server
runs-on: ubuntu-latest
environment:
name: production
url: https://blog.smswithoutborders.com
steps:
- name: Checkout Git Repository
uses: actions/checkout@v4
- name: Setup NodeJs
uses: actions/setup-node@v4
with:
node-version: 18
- name: Create .env.local file
run: echo "BASE_URL=${{ secrets.BASE_URL }}" > .env.local
- name: Install Dependencies
run: |
npm install -g pnpm
pnpm install
- name: Build Application
run: pnpm build
- name: Securely Copy Artifacts to Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "./out/*"
target: ${{ secrets.BUILD_PATH }}
strip_components: 1
rm: true
- name: πŸš€ Execute Remote SSH Commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
set -e
echo "============================"
echo "πŸš€ Deploy Project ..."
echo "============================"
if ! ${{secrets.BUILD_CMD}}; then
echo "❌ Error deploying project!"
exit 1
fi
echo "==============================="
echo "βœ… Deployment complete"
echo "==============================="