Skip to content

Commit

Permalink
Merge pull request #10 from IntelliTect-Samples/9-test-environment
Browse files Browse the repository at this point in the history
Configure test environment
  • Loading branch information
philspokas authored Nov 28, 2023
2 parents 952ac98 + 08f6d5d commit 0b92cfa
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: JokeUI396 CI/CD

on:
push:
branches:
- main
- 9-test-environment
workflow_dispatch:

permissions:
id-token: write
contents: read


jobs:
build_and_deploy_job:
runs-on: ubuntu-latest
name: Build and Deploy Job
environment: dev
steps:
- uses: actions/checkout@v3
- name: 'Login to Azure'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID_CREATED_SP }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Get app key
id: appkey
run: |
key=$(az staticwebapp secrets list --name JokeUi396-dev --query "properties.apiKey" -o tsv)
echo "key=$key" >> "$GITHUB_OUTPUT"
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ steps.appkey.outputs.key }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: ".output/server" # Api source code path - optional
output_location: ".output/public" # Built app content directory - optional
###### End of Repository/Build Configurations ######

1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- run: |
./display-value.ps1 ${{ secrets.ENVIRONMENTSECRET }}
echo "deployment value is $env:deploymentvalue"
dir env:
name: deploy
shell: pwsh
working-directory: tools
Expand Down
38 changes: 38 additions & 0 deletions build/env/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
param location string = resourceGroup().location
param JokeSiteName string = 'JokeUi396-dev'

resource JokeUi396_site_resource 'Microsoft.Web/staticSites@2022-09-01' = {
name: JokeSiteName
location: location
sku: {
name: 'Free'
tier: 'Free'
}
properties: {
repositoryUrl: 'https://github.com/IntelliTect-Samples/JokeUi396'
branch: 'main'
stagingEnvironmentPolicy: 'Enabled'
allowConfigFileUpdates: true
provider: 'GitHub'
enterpriseGradeCdnStatus: 'Disabled'
}
}

// resource Joke_APIM_resource 'Microsoft.Web/staticSites/linkedBackends@2022-09-01' = {
// name: 'jokeapim'
// kind: 'API Management'
// parent: JokeUi396_site_resource
// properties: {
// backendResourceId: subscriptionResourceId('Microsoft.ApiManagement/service', 'jokeapim')
// region: location
// }
// }

// '/subscriptions/a5045d8f-5a9a-4d29-aaee-1f829d64bee0/resourceGroups/jokefunction396/providers/Microsoft.ApiManagement/service/jokeapim'

// resource staticSites_JokeUi396_name_intellitectsamples_com 'Microsoft.Web/staticSites/customDomains@2022-09-01' = {
// parent:_JokeUi396_site_resource
// name: 'intellitectsamples.com'
// location: 'West US 2'
// properties: {}
// }
File renamed without changes.
8 changes: 8 additions & 0 deletions build/tools/scratch.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/~/Credentials/appId/875a99e3-f3f2-4db4-8c51-f6ff26ee5b32/isMSAApp~/false


az deployment group create --resource-group Joke-dev --template-file .\build\env\main.bicep

$key = az staticwebapp secrets list --name JokeUi396-dev --query "properties.apiKey" -o tsv

az staticwebapp show --name JokeUi396-dev --query "repositoryUrl"

0 comments on commit 0b92cfa

Please sign in to comment.