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:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -8,8 +8,10 @@ on:
|
|||||||
- 'package.json'
|
- 'package.json'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-version-and-deploy:
|
check-version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version_changed: ${{ steps.compare_versions.outputs.version_changed }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -21,7 +23,7 @@ jobs:
|
|||||||
git show HEAD:package.json > current_package.json
|
git show HEAD:package.json > current_package.json
|
||||||
git show HEAD~1:package.json > previous_package.json
|
git show HEAD~1:package.json > previous_package.json
|
||||||
|
|
||||||
- name: Compara versiones del proyecto
|
- name: Comparar versiones del proyecto
|
||||||
id: compare_versions
|
id: compare_versions
|
||||||
run: |
|
run: |
|
||||||
current_version=$(jq -r .version current_package.json)
|
current_version=$(jq -r .version current_package.json)
|
||||||
@@ -33,10 +35,19 @@ jobs:
|
|||||||
echo "La versión no ha cambiado"
|
echo "La versión no ha cambiado"
|
||||||
echo "version_changed=false" >> $GITHUB_OUTPUT
|
echo "version_changed=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
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
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
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
|
- name: Instalar Dependencias
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -44,10 +55,27 @@ jobs:
|
|||||||
- name: Compilar
|
- name: Compilar
|
||||||
run: npm run build
|
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
|
- name: Instalar ssh
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install sshpass
|
sudo apt-get install sshpass
|
||||||
|
|
||||||
- name: Subir al servidor
|
- name: Subir al servidor
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "websostenible",
|
"name": "websostenible",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev",
|
"dev": "astro dev",
|
||||||
"devhost": "astro dev --host",
|
"devhost": "astro dev --host",
|
||||||
|
|||||||
Reference in New Issue
Block a user