Compare commits
5 Commits
a223dfc7c0
...
test/20250
Author | SHA1 | Date | |
---|---|---|---|
750bcc81ef | |||
258b4ebfec | |||
2360630544 | |||
1ded384fd7 | |||
67e7fe35f9 |
35
.gitea/workflows/cleanup-tests-branches.yaml
Normal file
35
.gitea/workflows/cleanup-tests-branches.yaml
Normal 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
|
||||||
|
}
|
||||||
|
}
|
74
.gitea/workflows/construct-test.yaml
Normal file
74
.gitea/workflows/construct-test.yaml
Normal 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 }}
|
49
.gitea/workflows/deploy-back.yaml
Normal file
49
.gitea/workflows/deploy-back.yaml
Normal 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"
|
@@ -4,10 +4,10 @@ run-name: Deploying ${{ gitea.repository }} docs locally
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [closed]
|
types: [closed]
|
||||||
branches: [main]
|
branches: [master]
|
||||||
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
|
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [master]
|
||||||
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
|
paths: ["docs/**", "mkdocs.yml", ".gitea/workflows/deploy-docs.yaml"]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
@@ -15,6 +15,7 @@ on:
|
|||||||
description: "Branch to deploy"
|
description: "Branch to deploy"
|
||||||
required: true
|
required: true
|
||||||
default: "master"
|
default: "master"
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy-docs:
|
deploy-docs:
|
||||||
|
48
.gitea/workflows/deploy-front.yaml
Normal file
48
.gitea/workflows/deploy-front.yaml
Normal 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"
|
@@ -1,39 +0,0 @@
|
|||||||
name: Auto-Merge Dev
|
|
||||||
run-name: Merging changes from dev
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened]
|
|
||||||
branches: ["feature/*"]
|
|
||||||
push:
|
|
||||||
branches: ["feature/*"]
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
branch:
|
|
||||||
description: "Branch to merge from dev"
|
|
||||||
required: true
|
|
||||||
default: "feature/example"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
auto-merge-dev:
|
|
||||||
runs-on: windows # Ejecutar directamente en el host Windows
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Merge changes from dev
|
|
||||||
run: |
|
|
||||||
# Obtener la última versión de todas las ramas
|
|
||||||
git pull origin dev
|
|
||||||
|
|
||||||
# Intentar hacer merge de dev a la rama feature actual
|
|
||||||
git merge dev
|
|
||||||
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
|
||||||
# Si el merge fue exitoso (sin conflictos), hacer push
|
|
||||||
git push
|
|
||||||
} else {
|
|
||||||
# Si hubo conflictos, mostrar mensaje y salir con error para detener el pipeline
|
|
||||||
Write-Host "Conflictos detectados en el merge de dev a $branch, por favor resolver manualmente."
|
|
||||||
exit 1
|
|
||||||
}
|
|
Reference in New Issue
Block a user