Skip to content

Commit 38c77b5

Browse files
Merge pull request #4 from workcontrolgit/develop
Develop
2 parents 8a580ac + 657e303 commit 38c77b5

35 files changed

Lines changed: 5102 additions & 88 deletions
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Deploy Angular to Azure Static Web Apps
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'Clients/TalentManagement-Angular-Material/**'
9+
- '.github/workflows/deploy-angular.yml'
10+
workflow_dispatch:
11+
12+
permissions:
13+
id-token: write # Required for OIDC token request
14+
contents: read
15+
16+
env:
17+
ANGULAR_APP_DIR: 'Clients/TalentManagement-Angular-Material/talent-management'
18+
STATIC_WEB_APP_NAME: 'swa-talent-ui-dev'
19+
RESOURCE_GROUP: 'rg-talent-dev'
20+
21+
jobs:
22+
build-and-deploy:
23+
name: Build and Deploy Angular
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout repository (with submodules)
28+
uses: actions/checkout@v4
29+
with:
30+
submodules: recursive
31+
32+
- name: Set up Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '22.x'
36+
cache: 'npm'
37+
cache-dependency-path: '${{ env.ANGULAR_APP_DIR }}/package-lock.json'
38+
39+
- name: Install dependencies
40+
working-directory: ${{ env.ANGULAR_APP_DIR }}
41+
run: npm ci
42+
43+
- name: Inject production environment variables
44+
working-directory: ${{ env.ANGULAR_APP_DIR }}
45+
env:
46+
API_URL: ${{ secrets.API_APP_URL }}
47+
IDENTITY_SERVER_URL: ${{ secrets.IDENTITY_SERVER_URL }}
48+
run: |
49+
sed -i "s|https://your-production-api.com/api/v1|${API_URL}/api/v1|g" src/environments/environment.prod.ts
50+
sed -i "s|https://localhost:44310|${IDENTITY_SERVER_URL}|g" src/environments/environment.prod.ts
51+
52+
- name: Build Angular (production)
53+
working-directory: ${{ env.ANGULAR_APP_DIR }}
54+
run: npm run build -- --configuration production
55+
56+
- name: Log in to Azure
57+
uses: azure/login@v2
58+
with:
59+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
60+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
61+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
62+
63+
- name: Get Static Web App deployment token
64+
id: swa-token
65+
run: |
66+
SWA_TOKEN=$(az staticwebapp secrets list \
67+
--name ${{ env.STATIC_WEB_APP_NAME }} \
68+
--resource-group ${{ env.RESOURCE_GROUP }} \
69+
--query properties.apiKey \
70+
--output tsv)
71+
echo "token=${SWA_TOKEN}" >> $GITHUB_OUTPUT
72+
73+
- name: Deploy to Azure Static Web Apps
74+
uses: Azure/static-web-apps-deploy@v1
75+
with:
76+
azure_static_web_apps_api_token: ${{ steps.swa-token.outputs.token }}
77+
action: upload
78+
app_location: 'Clients/TalentManagement-Angular-Material/talent-management'
79+
output_location: 'dist/talent-management/browser'
80+
skip_app_build: true

.github/workflows/deploy-api.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Deploy .NET API to Azure App Service
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'ApiResources/TalentManagement-API/**'
9+
- '.github/workflows/deploy-api.yml'
10+
workflow_dispatch:
11+
12+
permissions:
13+
id-token: write # Required for OIDC token request
14+
contents: read
15+
16+
env:
17+
DOTNET_VERSION: '10.x'
18+
PROJECT_PATH: 'ApiResources/TalentManagement-API/TalentManagementAPI.WebApi/TalentManagementAPI.WebApi.csproj'
19+
SOLUTION_PATH: 'ApiResources/TalentManagement-API/TalentManagementAPI.slnx'
20+
PUBLISH_DIR: '${{ github.workspace }}/publish/api'
21+
APP_SERVICE_NAME: 'app-talent-api-dev'
22+
RESOURCE_GROUP: 'rg-talent-dev'
23+
24+
jobs:
25+
build-and-deploy:
26+
name: Build, Test, and Deploy API
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository (with submodules)
31+
uses: actions/checkout@v4
32+
with:
33+
submodules: recursive
34+
35+
- name: Set up .NET ${{ env.DOTNET_VERSION }}
36+
uses: actions/setup-dotnet@v4
37+
with:
38+
dotnet-version: ${{ env.DOTNET_VERSION }}
39+
40+
- name: Restore dependencies
41+
run: dotnet restore ${{ env.SOLUTION_PATH }}
42+
43+
- name: Build
44+
run: dotnet build ${{ env.SOLUTION_PATH }} --configuration Release --no-restore
45+
46+
- name: Run unit tests
47+
run: dotnet test ${{ env.SOLUTION_PATH }} --configuration Release --no-build --verbosity normal
48+
49+
- name: Publish
50+
run: |
51+
dotnet publish ${{ env.PROJECT_PATH }} \
52+
--configuration Release \
53+
--no-build \
54+
--output ${{ env.PUBLISH_DIR }}
55+
56+
- name: Log in to Azure
57+
uses: azure/login@v2
58+
with:
59+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
60+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
61+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
62+
63+
- name: Configure App Service settings
64+
run: |
65+
az webapp config appsettings set \
66+
--resource-group ${{ env.RESOURCE_GROUP }} \
67+
--name ${{ env.APP_SERVICE_NAME }} \
68+
--settings \
69+
"ConnectionStrings__DefaultConnection=${{ secrets.API_DB_CONNECTION_STRING }}" \
70+
"Sts__ServerUrl=${{ secrets.IDENTITY_SERVER_URL }}" \
71+
"Sts__ValidIssuer=${{ secrets.IDENTITY_SERVER_URL }}" \
72+
"Sts__Audience=app.api.talentmanagement" \
73+
"JWTSettings__Key=${{ secrets.JWT_KEY }}" \
74+
"JWTSettings__Issuer=CoreIdentity" \
75+
"JWTSettings__Audience=CoreIdentityUser" \
76+
"JWTSettings__DurationInMinutes=60" \
77+
"FeatureManagement__AuthEnabled=true" \
78+
"ASPNETCORE_ENVIRONMENT=Production"
79+
80+
- name: Deploy to Azure App Service
81+
uses: azure/webapps-deploy@v3
82+
with:
83+
app-name: ${{ env.APP_SERVICE_NAME }}
84+
package: ${{ env.PUBLISH_DIR }}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Deploy IdentityServer to Azure App Service
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'TokenService/Duende-IdentityServer/**'
9+
- '.github/workflows/deploy-identityserver.yml'
10+
workflow_dispatch:
11+
12+
permissions:
13+
id-token: write # Required for OIDC token request
14+
contents: read
15+
16+
env:
17+
DOTNET_VERSION: '8.x'
18+
STS_PROJECT_PATH: 'TokenService/Duende-IdentityServer/src/DuendeIdentityServer.STS.Identity/DuendeIdentityServer.STS.Identity.csproj'
19+
ADMIN_PROJECT_PATH: 'TokenService/Duende-IdentityServer/src/DuendeIdentityServer.Admin/DuendeIdentityServer.Admin.csproj'
20+
PUBLISH_DIR: '${{ github.workspace }}/publish/ids'
21+
APP_SERVICE_NAME: 'app-talent-ids-dev'
22+
RESOURCE_GROUP: 'rg-talent-dev'
23+
24+
jobs:
25+
build-and-deploy:
26+
name: Build, Test, and Deploy IdentityServer
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository (with submodules)
31+
uses: actions/checkout@v4
32+
with:
33+
submodules: recursive
34+
35+
- name: Set up .NET ${{ env.DOTNET_VERSION }}
36+
uses: actions/setup-dotnet@v4
37+
with:
38+
dotnet-version: ${{ env.DOTNET_VERSION }}
39+
40+
- name: Restore dependencies
41+
run: dotnet restore ${{ env.STS_PROJECT_PATH }}
42+
43+
- name: Build
44+
run: dotnet build ${{ env.STS_PROJECT_PATH }} --configuration Release --no-restore
45+
46+
- name: Publish
47+
run: |
48+
dotnet publish ${{ env.STS_PROJECT_PATH }} \
49+
--configuration Release \
50+
--no-build \
51+
--output ${{ env.PUBLISH_DIR }}
52+
53+
- name: Log in to Azure
54+
uses: azure/login@v2
55+
with:
56+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
57+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
58+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
59+
60+
- name: Configure App Service settings
61+
run: |
62+
az webapp config appsettings set \
63+
--resource-group ${{ env.RESOURCE_GROUP }} \
64+
--name ${{ env.APP_SERVICE_NAME }} \
65+
--settings \
66+
"ConnectionStrings__ConfigurationDbConnection=${{ secrets.IDS_DB_CONNECTION_STRING }}" \
67+
"ConnectionStrings__PersistedGrantDbConnection=${{ secrets.IDS_DB_CONNECTION_STRING }}" \
68+
"ConnectionStrings__IdentityDbConnection=${{ secrets.IDS_DB_CONNECTION_STRING }}" \
69+
"AdminConfiguration__IdentityServerBaseUrl=${{ secrets.IDENTITY_SERVER_URL }}" \
70+
"ASPNETCORE_ENVIRONMENT=Production"
71+
72+
- name: Deploy to Azure App Service
73+
uses: azure/webapps-deploy@v3
74+
with:
75+
app-name: ${{ env.APP_SERVICE_NAME }}
76+
package: ${{ env.PUBLISH_DIR }}

0 commit comments

Comments
 (0)