Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 37 additions & 63 deletions .github/workflows/azure-static-web-apps-black-desert-049c9d11e.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,37 @@
# name: Azure Static Web Apps CI/CD

# on:
# push:
# branches:
# - main
# pull_request:
# types: [opened, synchronize, reopened, closed]
# branches:
# - main

# jobs:
# build_and_deploy_job:
# if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
# runs-on: ubuntu-latest
# name: Build and Deploy Job
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: true
# lfs: false

# - name: Setup Node.js 20.x
# uses: actions/setup-node@v3
# with:
# node-version: '20'

# - name: Install Dependencies
# run: npm install

# - name: Build Application
# run: npm run build

# # - name: Debug: List build output
# # run: |
# # echo "Contents of dist/login-app:"
# # ls -R dist/login-app

# - name: Deploy to Azure Static Web Apps
# id: builddeploy
# uses: Azure/static-web-apps-deploy@v1
# with:
# azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLACK_DESERT_049C9D11E }}
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# action: "upload"
# app_location: "/" # Your Angular root
# api_location: "" # No API
# output_location: "dist/login-app/browser" # ✅ Correct path for Angular build

# close_pull_request_job:
# if: github.event_name == 'pull_request' && github.event.action == 'closed'
# runs-on: ubuntu-latest
# name: Close Pull Request Job
# steps:
# - name: Close Pull Request
# id: closepullrequest
# uses: Azure/static-web-apps-deploy@v1
# with:
# azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLACK_DESERT_049C9D11E }}
# action: "close"



name: Build and Deploy Angular App to Azure Web App

on:
push:
branches:
- main

env:
AZURE_WEBAPP_NAME: testsampleangular
NODE_VERSION: '20'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install dependencies
run: npm ci

- name: Build Angular app
run: npm run build -- --configuration production

- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: dist/login-app
55 changes: 9 additions & 46 deletions .github/workflows/login.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: CI & Deploy Angular App
name: Build and Test Angular Apps

on:
push:
branches: [main]
pull_request:
branches: [main]
branches:
- main

env:
AZURE_WEBAPP_NAME: testsampleangular
NODE_VERSION: '20'

jobs:
Expand All @@ -27,49 +25,14 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test -- --watch=false --browsers=ChromeHeadless

- name: Build Angular app
run: npm run build -- --configuration production

# Add a web.config to disable caching for index.html
- name: Add no-cache web.config
run: |
cat << 'EOF' > dist/login-app/browser/web.config
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="0.00:00:01" />
</staticContent>
</system.webServer>
</configuration>
EOF

- name: Upload build artifacts
uses: actions/upload-artifact@v4
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: angular-build
path: dist/login-app/browser/*

deploy:
needs: build-and-test
runs-on: ubuntu-latest
environment:
name: Production

steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: angular-build
path: ./build

- name: Zip build output
run: |
cd build
zip -r ../deploy.zip .

- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: deploy.zip
path: dist/login-app