Hello George Yang,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you would like to force change the angular cli to version 12 when deploying a static site.
Yes, there is a way you can do this in your GitHub Actions workflow for deploying to Azure Static Web Apps, you will specify the installation command in your workflow YAML file by ensure the following:
- The actions/setup-node@v2 action sets the Node.js version to 14.
- The npm install -g @angular/cli@12 command installs Angular CLI version 12 globally.
- The Azure/static-web-apps-deploy@v1 action deploys the built Angular project to Azure Static Web Apps.
name: Deploy Angular App to Azure Static Web Apps
on:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install Angular CLI globally
run: npm install -g @angular/cli@12
- name: Install dependencies
run: npm install
- name: Build Angular project
run: npm run build --prod
- name: Deploy to Azure Static Web Apps
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: 'upload'
app_location: '/'
output_location: 'dist/your-angular-app'
https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-angular
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful