From b072cc9177ec17c20d3e6c437edb0c005e1f56ca Mon Sep 17 00:00:00 2001 From: Naresh Kumar D Date: Wed, 1 Jul 2026 11:34:59 +0530 Subject: [PATCH 1/2] workflow testing Github workflow for testing purpose --- .github/workflows/deploy-to-azure.yml | 66 +++++++++++++++++++++++++++ staticwebapp.config.json | 5 ++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/deploy-to-azure.yml create mode 100644 staticwebapp.config.json diff --git a/.github/workflows/deploy-to-azure.yml b/.github/workflows/deploy-to-azure.yml new file mode 100644 index 0000000..99a4013 --- /dev/null +++ b/.github/workflows/deploy-to-azure.yml @@ -0,0 +1,66 @@ +name: Deploy to Azure Static Web Apps +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment to deploy to' + required: true + default: 'development' + type: choice + options: + - production + - staging + - development + - testing +jobs: + + set-github-environment: + runs-on: ubuntu-latest + outputs: + environment: ${{ steps.set-env.outputs.target_env }} + steps: + - name: Set Environment + id: set-env + run: | + case "${{ inputs.environment_input }}" in + testing) echo "target_env=Testing" >> $GITHUB_OUTPUT ;; + development) echo "target_env=dev" >> $GITHUB_OUTPUT ;; + staging) echo "target_env=stage" >> $GITHUB_OUTPUT ;; + production) echo "target_env=prod" >> $GITHUB_OUTPUT ;; + esac + + build-and-deploy: + needs: set-github-environment + runs-on: ubuntu-latest + environment: ${{ needs.set-github-environment.outputs.environment }} + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.environment }} + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + - name: Install Dependencies + run: npm install + - name: Ingest Environment Variables + run: | + touch .env + echo '${{ vars.ENV_CONFIG }}' | jq -r 'to_entries | map("\(.key)=\(.value)") | .[]' > .env + echo CI=false >> .env + - name: Build Project + run: npm run generate + - name: Copy WebApp Config + run: cp staticwebapp.config.json .output/public/staticwebapp.config.json + + - name: Deploy to Azure Static Web Apps + id: deploy + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} + action: "upload" + app_location: ".output/public" # App source code path + api_location: "" # Api source code path - optional + output_location: "" # Built app content directory - optional + skip_app_build: true \ No newline at end of file diff --git a/staticwebapp.config.json b/staticwebapp.config.json new file mode 100644 index 0000000..4a1bb1f --- /dev/null +++ b/staticwebapp.config.json @@ -0,0 +1,5 @@ +{ + "navigationFallback": { + "rewrite": "/index.html" + } +} \ No newline at end of file From c7ec82f4ad6db86eab13bc76e218546ac309f1c9 Mon Sep 17 00:00:00 2001 From: Naresh Kumar D Date: Wed, 1 Jul 2026 11:44:09 +0530 Subject: [PATCH 2/2] Update deploy-to-azure.yml --- .github/workflows/deploy-to-azure.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-to-azure.yml b/.github/workflows/deploy-to-azure.yml index 99a4013..a8c8a42 100644 --- a/.github/workflows/deploy-to-azure.yml +++ b/.github/workflows/deploy-to-azure.yml @@ -22,7 +22,7 @@ jobs: - name: Set Environment id: set-env run: | - case "${{ inputs.environment_input }}" in + case "${{ inputs.environment }}" in testing) echo "target_env=Testing" >> $GITHUB_OUTPUT ;; development) echo "target_env=dev" >> $GITHUB_OUTPUT ;; staging) echo "target_env=stage" >> $GITHUB_OUTPUT ;;