Skip to content

Commit 162665f

Browse files
committed
2 parents 300a54d + 97e82ad commit 162665f

3 files changed

Lines changed: 62 additions & 12 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Azure Static Web Apps CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened, closed]
9+
branches:
10+
- main
11+
12+
jobs:
13+
build_and_deploy_job:
14+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
15+
runs-on: ubuntu-latest
16+
name: Build and Deploy Job
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
submodules: true
21+
- name: Build And Deploy
22+
id: builddeploy
23+
uses: Azure/static-web-apps-deploy@v1
24+
with:
25+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_HAPPY_TREE_038F26503 }}
26+
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
27+
action: "upload"
28+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
29+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
30+
deployment_environment: "Test"
31+
app_location: "/PocketDDD.BlazorClient/PocketDDD.BlazorClient" # App source code path
32+
api_location: "" # Api source code path - optional
33+
output_location: "wwwroot" # Built app content directory - optional
34+
###### End of Repository/Build Configurations ######
35+
36+
close_pull_request_job:
37+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
38+
runs-on: ubuntu-latest
39+
name: Close Pull Request Job
40+
steps:
41+
- name: Close Pull Request
42+
id: closepullrequest
43+
uses: Azure/static-web-apps-deploy@v1
44+
with:
45+
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_HAPPY_TREE_038F26503 }}
46+
action: "close"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"apiUrl": "https://localhost:7069/api/",
2+
"apiUrl": "https://dddsw2023pocketdddserverwebapitest.azurewebsites.net/api/",
33
"fakeBackend": false
44
}

PocketDDD.BlazorClient/PocketDDD.BlazorClient/wwwroot/index.html

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,21 @@
2121
<a class="dismiss">🗙</a>
2222
</div>
2323
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
24-
<script>
25-
if (window.location.hostname.includes("localhost") || window.location.hostname.includes("development") ) {
26-
Blazor.start({
27-
environment: "Development"
28-
});
29-
} else {
30-
Blazor.start({
31-
environment: "Production"
32-
});
33-
}
34-
</script>
24+
<script>
25+
if (window.location.hostname.includes("localhost") || window.location.hostname.includes("development")) {
26+
Blazor.start({
27+
environment: "Development"
28+
});
29+
} else if (window.location.hostname.includes("test")) {
30+
Blazor.start({
31+
environment: "Test"
32+
});
33+
} else {
34+
Blazor.start({
35+
environment: "Production"
36+
});
37+
}
38+
</script>
3539

3640
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
3741
<script>navigator.serviceWorker.register('service-worker.js');</script>

0 commit comments

Comments
 (0)