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
53 changes: 53 additions & 0 deletions .github/workflows/azure-static-web-apps-calm-beach-08fe0410f.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Client

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: Echo
run: |
echo "BACKEND_URL: ${{ vars.BACKEND_URL }}"

- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_CALM_BEACH_08FE0410F }}
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: "/solution/client" # App source code path
api_location: "" # Api source code path - optional
output_location: "dist" # Built app content directory - optional
###### End of Repository/Build Configurations ######
env:
BACKEND_URL: ${{ vars.BACKEND_URL }}

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_CALM_BEACH_08FE0410F }}
action: "close"
84 changes: 84 additions & 0 deletions .github/workflows/main_func-stocks-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Server

on:
push:
branches:
- main
workflow_dispatch:

env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
NODE_VERSION: '20.x' # set this to the node version to use (supports 8.x, 10.x, 12.x)
PACKAGE_PATH: 'start/server'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read #This is required for actions/checkout

steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: 'Resolve Project Dependencies Using Npm'
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/${{ env.PACKAGE_PATH }}'
npm install
npm run build --if-present
npm run test --if-present
popd

- name: Zip artifact for deployment
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/${{ env.PACKAGE_PATH }}'
zip -r release.zip .
popd
cp ./${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/${{ env.PACKAGE_PATH }}/release.zip ./release.zip

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: node-app
path: release.zip

deploy:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_28A4ECB1D23C4E968A7E070D494F8F25 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_67141B8ACAD2433F80D0914712289FD8 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_0E24A16DA2524974B78FDA9EBCE10DA3 }}

- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: 'func-stocks-dev'
slot-name: 'Production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}

5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-azuretools.vscode-azurefunctions"
]
}
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Node Functions",
"type": "node",
"request": "attach",
"restart": true,
"port": 9229,
"preLaunchTask": "func: host start"
}
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"azureFunctions.projectSubpath": "start\\server",
"azureFunctions.deploySubpath": "start\\server",
"azureFunctions.postDeployTask": "npm install (functions)",
"azureFunctions.projectLanguage": "TypeScript",
"azureFunctions.projectRuntime": "~4",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.projectLanguageModel": 4,
"azureFunctions.preDeployTask": "npm prune (functions)"
}
68 changes: 68 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "func",
"label": "func: host start",
"command": "host start",
"problemMatcher": "$func-node-watch",
"isBackground": true,
"dependsOn": "npm watch (functions)",
"options": {
"cwd": "${workspaceFolder}/start\\server"
}
},
{
"type": "shell",
"label": "npm build (functions)",
"command": "npm run build",
"dependsOn": "npm clean (functions)",
"problemMatcher": "$tsc",
"options": {
"cwd": "${workspaceFolder}/start\\server"
}
},
{
"type": "shell",
"label": "npm watch (functions)",
"command": "npm run watch",
"dependsOn": "npm clean (functions)",
"problemMatcher": "$tsc-watch",
"group": {
"kind": "build",
"isDefault": true
},
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/start\\server"
}
},
{
"type": "shell",
"label": "npm install (functions)",
"command": "npm install",
"options": {
"cwd": "${workspaceFolder}/start\\server"
}
},
{
"type": "shell",
"label": "npm prune (functions)",
"command": "npm prune --production",
"dependsOn": "npm build (functions)",
"problemMatcher": [],
"options": {
"cwd": "${workspaceFolder}/start\\server"
}
},
{
"type": "shell",
"label": "npm clean (functions)",
"command": "npm run clean",
"dependsOn": "npm install (functions)",
"options": {
"cwd": "${workspaceFolder}/start\\server"
}
}
]
}
2 changes: 1 addition & 1 deletion example-client-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```yaml
name: Client - Azure Static Web Apps CI/CD
name: Client

on:
push:
Expand Down
3 changes: 2 additions & 1 deletion setup-resources/create-start-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ az cosmosdb sql container create \
--account-name $COMSOSDB_NAME \
--database-name stocksdb \
--name stocks \
--partition-key-path /symbol
--resource-group $RESOURCE_GROUP_NAME \
--partition-key-path "//symbol"

printf "Get storage connection string\n"

Expand Down
Loading