Skip to content

[PBS-108][HoangHN] feat: 🐳 cicd for fe project #7

[PBS-108][HoangHN] feat: 🐳 cicd for fe project

[PBS-108][HoangHN] feat: 🐳 cicd for fe project #7

Workflow file for this run

name: POD Booking System Client CICD
on:
push:
branches: ['main', 'develop']
pull_request:
branches: ['main', 'develop']
jobs:
build:
name: Build and analyze
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
uses: bahmutov/npm-install@v1
- name: Create .env file
run: |
echo "VITE_API_ENDPOINT=${{ secrets.VITE_API_ENDPOINT }}" >> .env
echo "VITE_URL=${{ secrets.VITE_URL }}" >> .env
echo "VITE_GOOGLE_CLIENT_ID=${{ secrets.VITE_GOOGLE_CLIENT_ID }}" >> .env
echo "VITE_GOOGLE_AUTHORIZED_REDIRECT_URI=${{ secrets.VITE_GOOGLE_AUTHORIZED_REDIRECT_URI }}" >> .env
echo "VITE_CLOUDINARY_CLOUD_NAME=${{ secrets.VITE_CLOUDINARY_CLOUD_NAME }}" >> .env
echo "VITE_CLOUDINARY_UPLOAD_PRESET=${{ secrets.VITE_CLOUDINARY_UPLOAD_PRESET }}" >> .env
echo "VITE_VNPAY_RETURN_URL=${{ secrets.VITE_VNPAY_RETURN_URL }}" >> .env
echo "VITE_VNPAY_RETURN_URL_AMENITY=${{ secrets.VITE_VNPAY_RETURN_URL_AMENITY }}" >> .env
echo "VITE_VNPAY_RETURN_ADMIN_URL=${{ secrets.VITE_VNPAY_RETURN_ADMIN_URL }}" >> .env
echo "VITE_VNPAY_RETURN_STAFF_AMENITY_URL=${{ secrets.VITE_VNPAY_RETURN_STAFF_AMENITY_URL }}" >> .env
echo "VITE_SOCKET_URL=${{ secrets.VITE_SOCKET_URL }}" >> .env
echo "VITE_API_KEY=${{ secrets.VITE_API_KEY }}" >> .env
echo "VITE_AUTH_DOMAIN=${{ secrets.VITE_AUTH_DOMAIN }}" >> .env
echo "VITE_PROJECT_ID=${{ secrets.VITE_PROJECT_ID }}" >> .env
echo "VITE_STORAGE_BUCKET=${{ secrets.VITE_STORAGE_BUCKET }}" >> .env
echo "VITE_MESSAGING_SENDER_ID=${{ secrets.VITE_MESSAGING_SENDER_ID }}" >> .env
echo "VITE_APP_ID=${{ secrets.VITE_APP_ID }}" >> .env
echo "VITE_MEASUREMENT_ID=${{ secrets.VITE_MEASUREMENT_ID }}" >> .env
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and tag Docker image
run: |
docker build -t hoanghuynguyen/pod-booking-system-client:latest .
- name: Push Docker image to Docker Hub
run: |
docker push hoanghuynguyen/pod-booking-system-client:latest
- name: Deploy to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
cd swp
docker pull hoanghuynguyen/pod-booking-system-client:latest
docker compose up -d
# # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
# - name: Update dependency graph
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6