Cambio Workflow
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Compilar y subir al Servidor
|
||||
name: Verificar versión, Compilar y Desplegar
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -8,8 +8,10 @@ on:
|
||||
- 'package.json'
|
||||
|
||||
jobs:
|
||||
check-version-and-deploy:
|
||||
check-version:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version_changed: ${{ steps.compare_versions.outputs.version_changed }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
@@ -21,7 +23,7 @@ jobs:
|
||||
git show HEAD:package.json > current_package.json
|
||||
git show HEAD~1:package.json > previous_package.json
|
||||
|
||||
- name: Compara versiones del proyecto
|
||||
- name: Comparar versiones del proyecto
|
||||
id: compare_versions
|
||||
run: |
|
||||
current_version=$(jq -r .version current_package.json)
|
||||
@@ -33,10 +35,19 @@ jobs:
|
||||
echo "La versión no ha cambiado"
|
||||
echo "version_changed=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
build:
|
||||
needs: check-version
|
||||
if: needs.check-version.outputs.version_changed == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '22' # Ajusta a la versión de Node.js que necesites
|
||||
node-version: '22' # Ajusta a la versión de Node.js que necesites
|
||||
|
||||
- name: Instalar Dependencias
|
||||
run: npm ci
|
||||
@@ -44,10 +55,27 @@ jobs:
|
||||
- name: Compilar
|
||||
run: npm run build
|
||||
|
||||
- name: Archivar build
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
|
||||
deploy:
|
||||
needs: [check-version, build]
|
||||
if: needs.check-version.outputs.version_changed == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Descargar build
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
|
||||
- name: Instalar ssh
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install sshpass
|
||||
sudo apt-get update
|
||||
sudo apt-get install sshpass
|
||||
|
||||
- name: Subir al servidor
|
||||
env:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "websostenible",
|
||||
"type": "module",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.6",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"devhost": "astro dev --host",
|
||||
|
||||
Reference in New Issue
Block a user