Skip to content

Commit 07277bf

Browse files
author
pixelead0
committed
Recuperar configuración de workflows y herramientas de desarrollo
- Agregar build.yml y ci-cd.yml workflows - Actualizar deploy.yml workflow - Configurar pre-commit hooks - Agregar requirements-dev.txt - Mejorar scripts de check_links y generate_meetups - Actualizar configuración markdownlint
1 parent c8b4fde commit 07277bf

File tree

8 files changed

+182
-41
lines changed

8 files changed

+182
-41
lines changed

.github/workflows/build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build and Validate
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-and-validate:
11+
name: Build and Validate Documentation
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.10'
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
29+
- name: Run pre-commit checks
30+
uses: pre-commit/[email protected]
31+
32+
- name: Build with MkDocs
33+
run: mkdocs build
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Check for broken links
38+
run: |
39+
cd site && python -m http.server 8000 &
40+
sleep 10
41+
42+
cd .. && python scripts/check_links.py
43+
44+
broken_count=$(jq '.summary.broken_links' broken_links.json)
45+
46+
if [ "$broken_count" -gt 0 ]; then
47+
echo "❌ Found $broken_count broken links - failing!"
48+
pkill -f "python -m http.server" || true
49+
exit 1
50+
fi
51+
52+
echo "✅ All links working!"
53+
pkill -f "python -m http.server" || true
54+
55+
# Solo para main: guardar el sitio construido
56+
- name: Upload build artifact
57+
if: github.ref == 'refs/heads/main'
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: site
61+
path: site/
62+
retention-days: 1

.github/workflows/ci-cd.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
build-and-validate:
16+
name: Build and Validate
17+
runs-on: ubuntu-latest
18+
steps:
19+
# ... todos los pasos de validación y build ...
20+
21+
deploy:
22+
name: Deploy to GitHub Pages
23+
if: github.ref == 'refs/heads/main'
24+
needs: build-and-validate
25+
runs-on: ubuntu-latest
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
steps:
30+
# ... pasos de deploy ...

.github/workflows/deploy.yml

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: Deploy to GitHub Pages
22

33
on:
4-
push:
5-
branches: [ main ]
6-
pull_request:
4+
workflow_run:
5+
workflows: ["Build and Validate"]
6+
types:
7+
- completed
78
branches: [ main ]
89

910
permissions:
@@ -16,45 +17,30 @@ concurrency:
1617
cancel-in-progress: false
1718

1819
jobs:
19-
build:
20+
deploy:
21+
name: Deploy to GitHub Pages
22+
if: github.event.workflow_run.conclusion == 'success'
2023
runs-on: ubuntu-latest
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
2127
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v4
24-
with:
25-
fetch-depth: 0
26-
27-
- name: Set up Python
28-
uses: actions/setup-python@v4
28+
- name: Download build artifact
29+
uses: actions/download-artifact@v3
2930
with:
30-
python-version: '3.10'
31-
32-
- name: Install dependencies
33-
run: |
34-
python -m pip install --upgrade pip
35-
pip install -r requirements.txt
36-
37-
- name: Build with MkDocs
38-
run: mkdocs build
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
name: site
32+
path: site/
33+
github-token: ${{ secrets.GITHUB_TOKEN }}
34+
run-id: ${{ github.event.workflow_run.id }}
4135

4236
- name: Setup Pages
4337
uses: actions/configure-pages@v4
4438

45-
- name: Upload artifact
39+
- name: Upload to GitHub Pages
4640
uses: actions/upload-pages-artifact@v3
4741
with:
48-
path: './site'
42+
path: site/
4943

50-
deploy:
51-
environment:
52-
name: github-pages
53-
url: ${{ steps.deployment.outputs.page_url }}
54-
runs-on: ubuntu-latest
55-
needs: build
56-
if: github.ref == 'refs/heads/main'
57-
steps:
5844
- name: Deploy to GitHub Pages
5945
id: deployment
6046
uses: actions/deploy-pages@v4

.markdownlint.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
{
2+
"MD001": true,
3+
"MD003": { "style": "atx" },
4+
"MD004": { "style": "dash" },
5+
"MD007": { "indent": 2 },
6+
"MD010": { "spaces_per_tab": 2 },
7+
"MD012": false,
8+
"MD013": { "line_length": 120 },
9+
"MD022": false,
10+
"MD025": true,
11+
"MD026": { "punctuation": ".,;:!?" },
12+
"MD029": { "style": "ordered" },
13+
"MD030": { "ul_single": 1, "ul_multi": 1, "ol_single": 1, "ol_multi": 1 },
14+
"MD031": false,
15+
"MD032": false,
216
"MD033": false,
17+
"MD034": false,
18+
"MD036": false,
319
"MD041": false,
4-
"MD013": false,
5-
"MD025": false,
6-
"MD026": false
20+
"MD051": false
721
}

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
# Hooks básicos
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.5.0
5+
hooks:
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
8+
- id: check-yaml
9+
exclude: ^mkdocs\.yml$ # Excluir mkdocs.yml
10+
- id: check-json
11+
- id: check-added-large-files
12+
- id: check-merge-conflict
13+
# - id: requirements-txt-fixer # Comentado si no lo quieres
14+
15+
# Validación de Markdown - MENOS ESTRICTO para empezar
16+
- repo: https://github.com/igorshubovych/markdownlint-cli
17+
rev: v0.39.0
18+
hooks:
19+
- id: markdownlint
20+
args: ['--config', '.markdownlint.json', '--disable', 'MD012', 'MD022', 'MD032']
21+
files: ^docs/.*\.md$
22+
23+
# Formateo de Python (opcional, pero útil para scripts)
24+
- repo: https://github.com/psf/black
25+
rev: 23.12.1
26+
hooks:
27+
- id: black
28+
files: ^scripts/.*\.py$

requirements-dev.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
# Herramientas de desarrollo (opcional)
3+
black>=23.0.0
4+
5+
# Herramientas opcionales de desarrollo
6+
flake8>=6.0.0
7+
# Pre-commit para validaciones locales
8+
pre-commit>=3.6.0
9+
pytest>=7.0.0
10+
11+
# Dependencias para validación de links
12+
requests>=2.25.0

scripts/check_links.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import json
77
import re
8+
import sys
89
from pathlib import Path
910
from urllib.parse import urljoin
1011

@@ -191,6 +192,17 @@ def main():
191192
print(f" Status: {link['status']}")
192193
print()
193194

195+
# Return number of broken links
196+
return len(broken_links)
197+
194198

195199
if __name__ == "__main__":
196-
main()
200+
broken_count = main()
201+
202+
# Exit with error if there are broken links
203+
if broken_count > 0:
204+
print(f"\n💥 Script failing due to {broken_count} broken links!")
205+
sys.exit(1)
206+
else:
207+
print("\n✅ Script completed successfully - all links working!")
208+
sys.exit(0)

scripts/generate_meetups.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,11 @@ def create_meetup_file(json_file):
4040
"event_location": data["event_location"],
4141
"event_rsvp_link": data.get("event_rsvp_link", "#"),
4242
"event_banner_image": data.get(
43-
"event_banner_image",
44-
"/assets/images/default-banner.jpg"
43+
"event_banner_image", "/assets/images/default-banner.jpg"
4544
),
4645
"event_month_year": data.get("event_month_year", ""),
4746
"tags": data["tags"],
48-
"last_update": data.get(
49-
"last_update", "Generado automáticamente"
50-
),
47+
"last_update": data.get("last_update", "Generado automáticamente"),
5148
}
5249

5350
# Agregar datos específicos según el tipo de template

0 commit comments

Comments
 (0)