2026-08-09 02:22:17 +00:00
|
|
|
name: Production CI/CD Pipeline
|
2026-08-08 12:47:58 +00:00
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
2026-08-09 02:22:17 +00:00
|
|
|
branches:
|
|
|
|
|
- main
|
2026-08-08 12:47:58 +00:00
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
build-and-test:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout Code
|
2026-08-09 02:22:17 +00:00
|
|
|
uses: actions/checkout@v3
|
2026-08-08 12:47:58 +00:00
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
|
|
- name: Lint
|
|
|
|
|
run: npm run lint
|
|
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
|
run: npm run test
|
|
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
|
|
- name: Upload Build Artifact
|
2026-08-09 02:11:14 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2026-08-08 12:47:58 +00:00
|
|
|
with:
|
|
|
|
|
name: dist
|
|
|
|
|
path: dist/
|
|
|
|
|
|
|
|
|
|
deploy-prod:
|
|
|
|
|
needs: build-and-test
|
|
|
|
|
runs-on: ubuntu-latest
|
2026-08-09 02:18:35 +00:00
|
|
|
environment:
|
|
|
|
|
name: production
|
2026-08-08 12:47:58 +00:00
|
|
|
steps:
|
|
|
|
|
- name: Download Build Artifact
|
2026-08-09 02:11:14 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2026-08-08 12:47:58 +00:00
|
|
|
with:
|
|
|
|
|
name: dist
|
|
|
|
|
path: dist
|
|
|
|
|
|
|
|
|
|
- name: Deploy to Production via FTP
|
|
|
|
|
env:
|
|
|
|
|
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
|
|
|
|
|
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
|
|
|
|
|
FTP_HOST: ${{ secrets.FTP_HOST }}
|
|
|
|
|
run: |
|
|
|
|
|
lftp -d -u "$FTP_USERNAME","$FTP_PASSWORD" -e "set ssl:verify-certificate no; set ftp:ssl-allow yes; set ftp:ssl-force true; set ftp:ssl-protect-data true; set ftp:passive-mode true; mirror -R dist/ ./; quit" $FTP_HOST
|