forked from nguyenhcp2004/pod-booking-system-client
-
Notifications
You must be signed in to change notification settings - Fork 0
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 nguyenhcp2004#243 from nguyenhcp2004/develop
Develop
- Loading branch information
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
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: Build project | ||
run: npm run build | ||
env: | ||
VITE_FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }} | ||
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }} | ||
VITE_FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }} | ||
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }} | ||
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }} | ||
VITE_FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }} | ||
VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.FIREBASE_MEASUREMENT_ID }} | ||
VITE_API_BASE_URL: ${{ secrets.API_BASE_URL }} | ||
|
||
- name: Upload production-ready build files | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: production-files | ||
path: ./dist | ||
|
||
deploy: | ||
name: Deploy to Server | ||
runs-on: ubuntu-22.04 | ||
needs: build # Job deploy depend on job build | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- 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 |