9 Commits

Author SHA1 Message Date
750bcc81ef Merge pull request 'workflow' (#38) from feature/docs into dev
All checks were successful
Deploy Documentation Local / deploy-docs (push) Successful in 45s
Deploy Documentation Local / deploy-docs (pull_request) Successful in 27s
Reviewed-on: #38
2025-09-02 00:55:29 +02:00
258b4ebfec --allow-unrelated-histories 2025-09-02 00:54:09 +02:00
2360630544 --allow-unrelated-histories
Some checks failed
Auto-Merge Dev / auto-merge-dev (push) Failing after 1m8s
2025-09-02 00:52:01 +02:00
1ded384fd7 workflows
Some checks failed
Auto-Merge Dev / auto-merge-dev (push) Failing after 1m18s
2025-09-02 00:46:34 +02:00
67e7fe35f9 workflow 2025-09-02 00:22:34 +02:00
a223dfc7c0 workflow
Some checks failed
Auto-Merge Dev / auto-merge-dev (push) Failing after 1m28s
2025-09-02 00:20:09 +02:00
c173cc3b3b workflow
Some checks failed
Auto-Merge Dev / auto-merge-dev (push) Failing after 1m11s
2025-09-02 00:16:26 +02:00
f121899b3b workflow
Some checks failed
Auto-Merge Dev / auto-merge-dev (push) Failing after 34s
2025-09-02 00:13:33 +02:00
523c147957 workflow
All checks were successful
Auto-Merge Dev / auto-merge-dev (push) Successful in 1m28s
2025-09-02 00:10:41 +02:00
6 changed files with 260 additions and 2 deletions

View File

@@ -0,0 +1,35 @@
name: Cleanup old test branches
on:
schedule:
- cron: "0 12 * * *"
workflow_dispatch:
jobs:
cleanup_branch:
runs-on: windows
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Delete test branches older than 7 days
shell: powershell
run: |
# Obtener la fecha límite (7 días antes)
$limitDate = (Get-Date).AddDays(-7)
# Obtener todas las ramas remotas test/*
$branches = git branch -r | Where-Object { $_ -match 'origin/test/' }
foreach ($branch in $branches) {
$branchName = $branch.Trim() -replace '^origin/', ''
# Obtener fecha de creación de la rama (aproximación por el primer commit)
$firstCommitDate = git log $branchName --reverse --format="%ci" | Select-Object -First 1
$branchDate = Get-Date $firstCommitDate
if ($branchDate -lt $limitDate) {
Write-Host "Eliminando rama $branchName creada el $branchDate"
git push origin --delete $branchName
}
}

View File

@@ -0,0 +1,74 @@
name: Create Test Construct
run-name: Creating test construct
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to build"
required: true
default: "dev"
schedule:
- cron: "0 12 * * *"
jobs:
create_test_branch_and_build:
runs-on: windows
steps:
- name: Checkout dev branch
uses: actions/checkout@v4
with:
ref: dev
- name: Create test branch with date
id: create_branch
shell: powershell
run: |
$date = Get-Date -Format "yyyyMMdd"
$branchName = "test/$date"
git checkout -b $branchName
git push origin $branchName
Write-Output "::set-output name=branch::$branchName"
deploy_docs:
needs: create_test_branch_and_build
runs-on: windows
steps:
- name: Checkout test branch
uses: actions/checkout@v4
with:
ref: ${{ steps.create_branch.outputs.branch }}
- name: Deploy documentation
uses: ./.gitea/workflows/deploy-docs.yaml
with:
branch: ${{ steps.create_branch.outputs.branch }}
deploy_back:
needs: create_test_branch_and_build
runs-on: windows
steps:
- name: Checkout test branch
uses: actions/checkout@v4
with:
ref: ${{ steps.create_branch.outputs.branch }}
- name: Deploy .net project
uses: ./.gitea/workflows/deploy-back.yaml
with:
branch: ${{ steps.create_branch.outputs.branch }}
deploy_front:
needs: create_test_branch_and_build
runs-on: windows
steps:
- name: Checkout test branch
uses: actions/checkout@v4
with:
ref: ${{ steps.create_branch.outputs.branch }}
- name: Deploy front project
uses: ./.gitea/workflows/deploy-front.yaml
with:
branch: ${{ steps.create_branch.outputs.branch }}

View File

@@ -0,0 +1,49 @@
name: Create Test Construct
run-name: Creating test construct
on:
pull_request:
types: [closed]
branches: [dev, "test/**"]
paths: ["back/**"]
workflow_dispatch:
inputs:
branch:
description: "Branch to deploy"
required: true
default: "dev"
workflow_call:
jobs:
build_and_deploy:
runs-on: windows
steps:
- name: Checkout branch
uses: actions/checkout@v4
# build .net project
- name: Build .NET Project
run: |
dotnet restore
dotnet build
# deploy .net to iis site with path = "D:\iis\es\mcvingenieros\mmorales.photo\back"
- name: Deploy .net project to iis
shell: powershell
run: |
# deploy to iis site back.mmorales.photo that has path = D:\iis\es\mcvingenieros\mmorales.photo\back\
$sourcePath = "D:\iis\es\mcvingenieros\mmorales.photo\back\bin\Release\net9.0\publish"
$destinationPath = "D:\iis\es\mcvingenieros\mmorales.photo\back\"
# Stop IIS site
Stop-WebAppPool -Name "mmorales.photo.back"
# Remove old files
Remove-Item -Path $destinationPath\* -Recurse -Force
# Copy new files
Copy-Item -Path $sourcePath\* -Destination $destinationPath -Recurse
# Start IIS site
Start-WebAppPool -Name "mmorales.photo.back"

View File

@@ -4,10 +4,10 @@ run-name: Deploying ${{ gitea.repository }} docs locally
on:
pull_request:
types: [closed]
branches: [main]
branches: [master]
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
push:
branches: [main]
branches: [master]
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
workflow_dispatch:
inputs:
@@ -15,6 +15,7 @@ on:
description: "Branch to deploy"
required: true
default: "master"
workflow_call:
jobs:
deploy-docs:

View File

@@ -0,0 +1,48 @@
name: deploy front
run-name: Deploy Frontend
on:
pull_request:
types: [closed]
branches: [dev, "test/**"]
paths: ["front/**"]
workflow_dispatch:
inputs:
branch:
description: "Branch to deploy"
required: true
default: "dev"
workflow_call:
jobs:
build_and_deploy:
runs-on: windows
steps:
- name: Checkout branch
uses: actions/checkout@v4
# build angular
- name: Build Angular
run: |
npm install
npm run build
- name: Deploy to IIS
shell: powershell
run: |
# deploy to iis site front.mmorales.photo that has path = D:\iis\es\mcvingenieros\mmorales.photo\front\
$sourcePath = "D:\iis\es\mcvingenieros\mmorales.photo\front\dist"
$destinationPath = "D:\iis\es\mcvingenieros\mmorales.photo\front\"
# Stop IIS site
Stop-WebAppPool -Name "mmorales.photo.front"
# Remove old files
Remove-Item -Path $destinationPath\* -Recurse -Force
# Copy new files
Copy-Item -Path $sourcePath\* -Destination $destinationPath -Recurse
# Start IIS site
Start-WebAppPool -Name "mmorales.photo.front"

51
docs/gitflow.md Normal file
View File

@@ -0,0 +1,51 @@
# Galerias Fotograficas -- Git flow
Para poder aportar al desarrollo de nuevas funcionalidades en las galerías fotográficas, todos los cambios pasan un flujo de tests al hacer push sobre cualqueir rama.
Cuando se hace push sobre una rama, se hará un merge de `dev` automaticamente. Tras este merge, se comprobará que no hayan conflictos.
Justo después, se compilará el back, el front, los tests y los documentos. En caso de que alguno de estos pasos falle, se notificará al desarrollador responsable para que pueda solucionarlo.
Una vez al dia, se realizará una revisión de las ramas en `dev` para generar una rama `staging/{date}` que se publicará con los cambios del día anterior, siempre y cuando hayan conseguido pasar todos los tests.
Para poder aportar sobre nuevas funcionalidades, se deben seguir los siguientes pasos:
1. Crear una nueva rama a partir de `dev` que se llame `feature/[nombre-de-la-funcionalidad]`.
2. Realizar los cambios necesarios en la nueva rama.
3. Hacer push de la rama al repositorio remoto.
4. Crear un Pull Request (PR) para que los cambios sean revisados e integrados en `dev`.
Una vez que el PR sea aprobado, los cambios se fusionarán en `dev`.
Se seguirá el siguiente flujo:
gitGraph
commit
branch develop
checkout develop
commit
commit
checkout develop
branch "feature/one"
checkout develop
commit
checkout "feature/one"
commit
checkout develop
branch "feature/two"
checkout develop
commit
commit
commit
checkout "feature/two"
commit
commit
merge develop
checkout develop
merge "feature/two"
checkout "feature/one"
commit
merge develop
checkout develop
merge "feature/one"
commit
checkout main
merge develop id: "release" tag: "release/{date}"