Skip to content

Update README.md

Update README.md #84

Workflow file for this run

name: Deploy Static Files
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
env:
NODE_ENV: production
API_BASE_URL: https://api.gaia-air.example.com
ANALYTICS_KEY: ${{ secrets.ANALYTICS_KEY }}
jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: npm ci
- name: Run Linter
run: npm run lint
- name: Run Security Audit
run: npm audit --audit-level=moderate
- name: Run Tests
run: npm test -- --ci --coverage
- name: Build Static Files
run: npm run build
# Opcional: subir reportes de cobertura a Codecov
# - name: Upload Coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage/lcov.info
# flags: unittests
# name: code-coverage
deploy:
runs-on: ubuntu-latest
needs: build_and_test
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Dependencies
run: npm ci
- name: Build Static Files
run: npm run build
# Despliegue a GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
# Despliegue a AWS S3 (descomentar si se necesita)
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v2
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: us-east-1
#
# - name: Sync to S3
# run: aws s3 sync ./dist s3://gaia-air-static-site/ --delete
# Invalidar caché en CloudFront (descomentar si se usa CDN)
# - name: Invalidate CloudFront
# run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"
# Notificación en Slack (opcional)
# - name: Notify Slack
# uses: slackapi/[email protected]
# with:
# payload: '{"text":"Despliegue a producción completado exitosamente."}'
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}