Refactor and format Razor views for improved readability and consistency #222
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Prd | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 9 * * 3" | |
| permissions: {} | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| jobs: | |
| detect-changes: | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| outputs: | |
| src: ${{ steps.changes.outputs.src }} | |
| terraform: ${{ steps.changes.outputs.terraform }} | |
| steps: | |
| - id: changes | |
| uses: frasermolyneux/actions/detect-changes@main | |
| with: | |
| filters: | | |
| src:src/** | |
| terraform:terraform/** | |
| terraform-state-check-dev: | |
| if: github.event_name != 'schedule' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| environment: Development | |
| runs-on: ubuntu-latest | |
| outputs: | |
| has_resources: ${{ steps.state-check.outputs.has_resources }} | |
| state_tainted: ${{ steps.state-check.outputs.state_tainted }} | |
| steps: | |
| - id: state-check | |
| uses: frasermolyneux/actions/terraform-state-check@terraform-state-check/v1.1 | |
| with: | |
| terraform-folder: "terraform" | |
| terraform-var-file: "tfvars/dev.tfvars" | |
| terraform-backend-file: "backends/dev.backend.hcl" | |
| AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| build-and-test: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| needs: | |
| - detect-changes | |
| - terraform-state-check-dev | |
| if: "!failure() && !cancelled() && (needs.detect-changes.outputs.src == 'true' || needs.terraform-state-check-dev.outputs.state_tainted == 'true')" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| build_version: ${{ steps.web-ci.outputs.build_version }} | |
| steps: | |
| - id: web-ci | |
| uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4 | |
| with: | |
| dotnet-project: "XtremeIdiots.Portal.Web" | |
| dotnet-version: 9.0.x | |
| src-folder: "src" | |
| skip-nuget-artifact-upload: "true" | |
| terraform-plan-and-apply-dev: | |
| if: github.event_name != 'schedule' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| environment: Development | |
| needs: | |
| - detect-changes | |
| - terraform-state-check-dev | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.repository }}-dev | |
| steps: | |
| - uses: frasermolyneux/actions/terraform-plan-and-apply@terraform-plan-and-apply/v1.4 | |
| if: needs.detect-changes.outputs.terraform == 'true' || needs.terraform-state-check-dev.outputs.state_tainted == 'true' | |
| with: | |
| terraform-folder: "terraform" | |
| terraform-var-file: "tfvars/dev.tfvars" | |
| terraform-backend-file: "backends/dev.backend.hcl" | |
| AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| - uses: frasermolyneux/actions/terraform-output@terraform-output/v1.0 | |
| if: needs.detect-changes.outputs.terraform != 'true' && needs.terraform-state-check-dev.outputs.state_tainted != 'true' | |
| with: | |
| terraform-folder: "terraform" | |
| terraform-var-file: "tfvars/dev.tfvars" | |
| terraform-backend-file: "backends/dev.backend.hcl" | |
| AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| - id: terraform-output-dev | |
| shell: bash | |
| run: | | |
| cd terraform | |
| echo "web_app_name=$(terraform output -raw web_app_name)" >> $GITHUB_OUTPUT | |
| echo "web_app_resource_group=$(terraform output -raw web_app_resource_group)" >> $GITHUB_OUTPUT | |
| env: | |
| ARM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| ARM_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| ARM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| ARM_USE_AZUREAD: true | |
| ARM_USE_OIDC: true | |
| outputs: | |
| web_app_name: ${{ steps.terraform-output-dev.outputs.web_app_name }} | |
| web_app_resource_group: ${{ steps.terraform-output-dev.outputs.web_app_resource_group }} | |
| app-service-deploy-dev: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| environment: Development | |
| needs: | |
| - detect-changes | |
| - build-and-test | |
| - terraform-plan-and-apply-dev | |
| if: | | |
| !failure() && !cancelled() && github.event_name != 'schedule' && needs.detect-changes.outputs.src == 'true' | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.repository }}-dev | |
| steps: | |
| - name: Deploy v${{ needs.build-and-test.outputs.build_version }} | |
| uses: frasermolyneux/actions/deploy-app-service@deploy-app-service/v1.2 | |
| with: | |
| web-artifact-name: "XtremeIdiots.Portal.Web" | |
| web-app-name: ${{ needs.terraform-plan-and-apply-dev.outputs.web_app_name }} | |
| resource-group-name: ${{ needs.terraform-plan-and-apply-dev.outputs.web_app_resource_group }} | |
| AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| - uses: frasermolyneux/actions/wait-for-version@wait-for-version/v1.0 | |
| with: | |
| info-url: "https://${{ needs.terraform-plan-and-apply-dev.outputs.web_app_name }}.azurewebsites.net/info" | |
| expected-version: ${{ needs.build-and-test.outputs.build_version }} | |
| terraform-plan-and-apply-prd: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| environment: Production | |
| needs: | |
| - detect-changes | |
| - terraform-plan-and-apply-dev | |
| - app-service-deploy-dev | |
| if: | | |
| !failure() && !cancelled() && (needs.terraform-plan-and-apply-dev.result == 'success' || github.event_name == 'schedule') | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.repository }}-prd | |
| steps: | |
| - uses: frasermolyneux/actions/terraform-plan-and-apply@terraform-plan-and-apply/v1.4 | |
| if: needs.detect-changes.outputs.terraform == 'true' | |
| with: | |
| terraform-folder: "terraform" | |
| terraform-var-file: "tfvars/prd.tfvars" | |
| terraform-backend-file: "backends/prd.backend.hcl" | |
| AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| - uses: frasermolyneux/actions/terraform-output@terraform-output/v1.0 | |
| if: needs.detect-changes.outputs.terraform != 'true' | |
| with: | |
| terraform-folder: "terraform" | |
| terraform-var-file: "tfvars/prd.tfvars" | |
| terraform-backend-file: "backends/prd.backend.hcl" | |
| AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| - id: terraform-output-prd | |
| shell: bash | |
| run: | | |
| cd terraform | |
| echo "web_app_name=$(terraform output -raw web_app_name)" >> $GITHUB_OUTPUT | |
| echo "web_app_resource_group=$(terraform output -raw web_app_resource_group)" >> $GITHUB_OUTPUT | |
| env: | |
| ARM_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| ARM_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| ARM_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| ARM_USE_AZUREAD: true | |
| ARM_USE_OIDC: true | |
| outputs: | |
| web_app_name: ${{ steps.terraform-output-prd.outputs.web_app_name }} | |
| web_app_resource_group: ${{ steps.terraform-output-prd.outputs.web_app_resource_group }} | |
| app-service-deploy-prd: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| environment: Production | |
| needs: | |
| - detect-changes | |
| - build-and-test | |
| - terraform-plan-and-apply-prd | |
| if: | | |
| !failure() && !cancelled() && needs.terraform-plan-and-apply-prd.result == 'success' && needs.detect-changes.outputs.src == 'true' | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.repository }}-prd | |
| steps: | |
| - name: Deploy v${{ needs.build-and-test.outputs.build_version }} | |
| uses: frasermolyneux/actions/deploy-app-service@deploy-app-service/v1.2 | |
| with: | |
| web-artifact-name: "XtremeIdiots.Portal.Web" | |
| web-app-name: ${{ needs.terraform-plan-and-apply-prd.outputs.web_app_name }} | |
| resource-group-name: ${{ needs.terraform-plan-and-apply-prd.outputs.web_app_resource_group }} | |
| AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| - uses: frasermolyneux/actions/wait-for-version@wait-for-version/v1.0 | |
| with: | |
| info-url: "https://${{ needs.terraform-plan-and-apply-prd.outputs.web_app_name }}.azurewebsites.net/info" | |
| expected-version: ${{ needs.build-and-test.outputs.build_version }} |