@@ -117,9 +117,74 @@ Abre el workflow en GitHub y modifica el paso **Build And Deploy** con lo siguie
117117 app_build_command : API_URL=${{ secrets.API_URL}} npm run build-with-api-url
118118 app_location : " /"
119119 api_location : " "
120- output_location : " dist/angular-tour-of-heroes"
120+ output_location : " dist/angular-tour-of-heroes/browser "
121121` ` `
122122
123+ Importante! El flujo que crea Static Web Apps se apoya en Node 18 pero nuestra app usa Node 20 por lo que también es necesario añadir como variable
124+ ` ` ` yaml
125+ - name : Build And Deploy
126+ id : builddeploy
127+ uses : Azure/static-web-apps-deploy@v1
128+ env :
129+ NODE_VERSION : 20
130+ ` ` `
131+
132+ el YAML final quedaría así:
133+
134+ ` ` ` yaml
135+ name : Azure Static Web Apps CI/CD
136+
137+ on :
138+ push :
139+ branches :
140+ - main
141+ pull_request :
142+ types : [opened, synchronize, reopened, closed]
143+ branches :
144+ - main
145+
146+ jobs :
147+ build_and_deploy_job :
148+ if : github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
149+ runs-on : ubuntu-latest
150+ name : Build and Deploy Job
151+ steps :
152+ - uses : actions/checkout@v3
153+ with :
154+ submodules : true
155+ lfs : false
156+ - name : Build And Deploy
157+ id : builddeploy
158+ uses : Azure/static-web-apps-deploy@v1
159+ env :
160+ NODE_VERSION : 20 # 🆕 Nuevo incluido por mi
161+ with :
162+ azure_static_web_apps_api_token : ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_BAY_033E22103 }}
163+ repo_token : ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
164+ action : ' upload'
165+ # ##### Repository/Build Configurations - These values can be configured to match your app requirements. ######
166+ # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
167+ app_location : ' /' # App source code path
168+ api_location : ' ' # Api source code path - optional
169+ output_location : ' dist/angular-tour-of-heroes/browser' # Built app content directory - optional
170+ app_build_command : API_URL=${{ secrets.API_URL}} npm run build-with-api-url
171+ # ##### End of Repository/Build Configurations ######
172+
173+ close_pull_request_job :
174+ if : github.event_name == 'pull_request' && github.event.action == 'closed'
175+ runs-on : ubuntu-latest
176+ name : Close Pull Request Job
177+ steps :
178+ - name : Close Pull Request
179+ id : closepullrequest
180+ uses : Azure/static-web-apps-deploy@v1
181+ with :
182+ azure_static_web_apps_api_token : ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_GENTLE_BAY_033E22103 }}
183+ action : ' close'
184+
185+ ```
186+
187+
123188### ¿Qué cambió?
124189
125190Solo añadimos la propiedad ` app_build_command ` que:
0 commit comments