Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Merge pull request #282 from igrowker/boton-google #121

Merge pull request #282 from igrowker/boton-google

Merge pull request #282 from igrowker/boton-google #121

name: Build and Deploy to Dev
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- develop
push:
branches:
- develop
concurrency:
group: build-deploy-dev-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
statuses: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Build
run: npm run build
- name: Create issue if build fails
if: failure()
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
ACTION_TYPE: 'Build'
URL_ACTION_RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
BRANCH: ${{ github.ref }}
with:
assignees: ${{ github.event.sender.login }}
- name: Comment on PR if failed
if: failure() && (github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'main')
uses: unsplash/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
msg: '🔴 Falló el build de la rama :disappointed: ⚠️🛑. Por favor revisa los errores y toma las medidas necesarias. Action Run: [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})'
- name: Comment on PR
if: github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'main'
uses: unsplash/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
msg: '🟢 El build ha sido exitoso :+1: :thumbsup:.'
check_for_duplicate_msg: false
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
statuses: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Lint
run: npm run lint:ci
- name: Create issue if lint fails
if: failure()
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
ACTION_TYPE: 'Lint'
URL_ACTION_RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
BRANCH: ${{ github.ref }}
with:
assignees: ${{ github.event.sender.login }}
- name: Comment on PR if failed
if: failure() && (github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'main')
uses: unsplash/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
msg: '🔴 Falló la verificación del Lint :dissapointed: ⚠️🛑. Por favor revisa los errores y toma las medidas necesarias. Action Run: [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})'
- name: Comment on PR
if: github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'main'
uses: unsplash/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
msg: '🟢 El linter ha verificado el código :+1: :thumbsup:.'
check_for_duplicate_msg: false
deploy:
runs-on: ubuntu-latest
env:
VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }}
VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.VITE_FIREBASE_MEASUREMENT_ID }}
VITE_FIREBASE_VAPID_KEY: ${{ secrets.VITE_FIREBASE_VAPID_KEY }}
VITE_GOOGLE_CLIENT_ID: ${{ secrets.VITE_GOOGLE_CLIENT_ID }}
VITE_BACK_URL: ${{ secrets.VITE_BACK_URL }}
needs: [build, lint]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Build
run: npm run build
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: './dist'
production-branch: develop
github-token: ${{ secrets.GH_TOKEN }}
deploy-message: 'Deploy from GitHub Actions'
enable-pull-request-comment: true
enable-commit-comment: true
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
- name: Create issue if build fails
if: failure()
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
ACTION_TYPE: 'Deploy to Dev'
URL_ACTION_RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
BRANCH: ${{ github.ref }}
with:
assignees: ${{ github.event.sender.login }}
- name: Comment on PR if failed
if: failure() && (github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'main')
uses: unsplash/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
msg: '🔴 Ocurrió un error al desplegar la rama ⚠️🛑. Por favor revisa los errores y toma las medidas necesarias. Action Run: [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).'
check_for_duplicate_msg: false