|
| 1 | +name: Manual Spring Boot & Java Update |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + springboot_version: |
| 7 | + description: 'Versión de Spring Boot (ej: 3.4.1)' |
| 8 | + required: true |
| 9 | + default: '3.4.1' |
| 10 | + java_version: |
| 11 | + description: 'Versión de Java (ej: 17, 21)' |
| 12 | + required: true |
| 13 | + default: '17' |
| 14 | + |
| 15 | +jobs: |
| 16 | + update-project-stack: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Set up JDK |
| 23 | + uses: actions/setup-java@v4 |
| 24 | + with: |
| 25 | + java-version: ${{ github.event.inputs.java_version }} |
| 26 | + distribution: 'temurin' |
| 27 | + |
| 28 | + - name: Update Spring Boot Parent Version |
| 29 | + run: | |
| 30 | + # Actualiza la versión dentro del bloque parent de Spring Boot |
| 31 | + find . -name "pom.xml" -exec sed -i "/<artifactId>spring-boot-starter-parent<\/artifactId>/!b;n;s/<version>.*<\/version>/<version>${{ github.event.inputs.springboot_version }}<\/version>/" {} + |
| 32 | +
|
| 33 | + - name: Update Java Version Property |
| 34 | + run: | |
| 35 | + # Actualiza la propiedad <java.version> en todos los poms |
| 36 | + find . -name "pom.xml" -exec sed -i "s/<java.version>.*<\/java.version>/<java.version>${{ github.event.inputs.java_version }}<\/java.version>/" {} + |
| 37 | + |
| 38 | + # Opcional: Actualizar también maven.compiler.source/target si existen |
| 39 | + find . -name "pom.xml" -exec sed -i "s/<maven.compiler.source>.*<\/maven.compiler.source>/<maven.compiler.source>${{ github.event.inputs.java_version }}<\/maven.compiler.source>/" {} + |
| 40 | + find . -name "pom.xml" -exec sed -i "s/<maven.compiler.target>.*<\/maven.compiler.target>/<maven.compiler.target>${{ github.event.inputs.java_version }}<\/maven.compiler.target>/" {} + |
| 41 | +
|
| 42 | + - name: Verify Updates |
| 43 | + run: | |
| 44 | + echo "Verificando cambios en el primer pom.xml encontrado:" |
| 45 | + FIRST_POM=$(find . -name "pom.xml" | head -n 1) |
| 46 | + grep -E "spring-boot-starter-parent|java.version|version" $FIRST_POM | head -n 15 |
| 47 | +
|
| 48 | + - name: Create Pull Request |
| 49 | + uses: peter-evans/create-pull-request@v6 |
| 50 | + with: |
| 51 | + commit-message: "upgrade: Spring Boot to ${{ github.event.inputs.springboot_version }} and Java to ${{ github.event.inputs.java_version }}" |
| 52 | + title: "Upgrade Stack: Spring Boot ${{ github.event.inputs.springboot_version }} / Java ${{ github.event.inputs.java_version }}" |
| 53 | + body: | |
| 54 | + Actualización automática del stack tecnológico: |
| 55 | + - **Spring Boot:** ${{ github.event.inputs.springboot_version }} |
| 56 | + - **Java:** ${{ github.event.inputs.java_version }} |
| 57 | + |
| 58 | + Revisar posibles errores de compilación en los logs de esta acción. |
| 59 | + branch: "upgrade-stack-${{ github.event.inputs.springboot_version }}-java${{ github.event.inputs.java_version }}" |
0 commit comments