Skip to content

Commit 84d207f

Browse files
authored
Upgrade GitHub workflows to use centralized global.json for .NET version (#735)
### Summary & motivation - Replace all hardcoded `dotnet-version: 9.0.x` values in GitHub workflows with a reference to the centralized `global.json` file for consistent .NET versioning - Reformat GitHub workflow files to use consistent indentation around blank lines This change fixes a sporadic error where the actions/setup-dotnet@v4 GitHub task sometimes installed an incorrect .NET version, causing workflows to fail. ### Downstream projects Update all GitHub workflow files to reference the `global.json` file instead of hardcoded versions: ```diff - dotnet-version: 9.0.x + global-json-file: application/global.json ``` ### Checklist - [x] I have added tests, or done manual regression tests - [x] I have updated the documentation, if necessary
2 parents abf174d + 0202649 commit 84d207f

7 files changed

Lines changed: 15 additions & 15 deletions

.github/workflows/_deploy-container.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
if: inputs.azure_environment == 'prod'
7373
run: |
7474
STAGING_REGISTRY_ID="/subscriptions/${{ vars.STAGING_SUBSCRIPTION_ID }}/resourceGroups/${{ env.UNIQUE_PREFIX }}-stage/providers/Microsoft.ContainerRegistry/registries/${{ env.UNIQUE_PREFIX }}stage"
75-
75+
7676
az acr import \
7777
--name ${{ env.UNIQUE_PREFIX }}${{ env.ENVIRONMENT }} \
7878
--source ${{ inputs.image_name }}:${{ inputs.version }} \
@@ -117,7 +117,7 @@ jobs:
117117
echo "New revision is Unhealthy. Running state: $RUNNING_STATUS"
118118
exit 1
119119
fi
120-
120+
121121
echo "($i) Waiting for revision to become active. Running state: $RUNNING_STATUS"
122122
done
123123
echo "New revision did not become active in time. Running state: $RUNNING_STATUS"

.github/workflows/_deploy-infrastructure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: Plan Cluster Resources
6767
id: deploy_cluster
6868
run: bash ./cloud-infrastructure/cluster/deploy-cluster.sh ${{ inputs.unique_prefix }} ${{ inputs.azure_environment }} ${{ inputs.cluster_location }} ${{ inputs.cluster_location_acronym }} ${{ inputs.sql_admin_object_id }} ${{ inputs.domain_name }} --plan
69-
69+
7070
deploy:
7171
name: Deploy
7272
if: ${{ github.ref == 'refs/heads/main' }}

.github/workflows/_migrate-database.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Setup .NET Core SDK
6363
uses: actions/setup-dotnet@v4
6464
with:
65-
dotnet-version: 9.0.x
65+
global-json-file: application/global.json
6666

6767
- name: Restore .NET Tools
6868
working-directory: application
@@ -93,7 +93,7 @@ jobs:
9393
run: |
9494
CONNECTION_STRING="Server=tcp:${{ env.SQL_SERVER_FQDN }},1433;Database=${{ inputs.database_name }};Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;Authentication=Active Directory Default;"
9595
96-
echo "Checking for pending migrations..."
96+
echo "Checking for pending migrations..."
9797
MIGRATION_INFO=$(dotnet ef migrations list \
9898
--project ${{ inputs.relative_project_path }} \
9999
--startup-project ${{ inputs.relative_startup_project }} \
@@ -137,7 +137,7 @@ jobs:
137137
echo "$MIGRATION_JSON"
138138
echo "has_migrations_to_apply=false" >> $GITHUB_OUTPUT
139139
fi
140-
140+
141141
- name: Close Firewall
142142
if: always()
143143
working-directory: cloud-infrastructure/cluster
@@ -168,7 +168,7 @@ jobs:
168168
const migrationsList = migrationJson.map(m => `- ${m.name} (${m.id})`).join('\n');
169169
170170
const migrationInfo = `## Approve Database Migration \`${{ inputs.database_name }}\` database on \`${{ inputs.azure_environment }}\`
171-
171+
172172
The following pending migration(s) will be applied to the database when approved:
173173
${migrationsList}
174174

.github/workflows/account-management.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
- name: Setup .NET Core SDK
7676
uses: actions/setup-dotnet@v4
7777
with:
78-
dotnet-version: 9.0.x
78+
global-json-file: application/global.json
7979

8080
- name: Restore .NET Tools
8181
working-directory: application
@@ -174,7 +174,7 @@ jobs:
174174
- name: Setup .NET Core SDK
175175
uses: actions/setup-dotnet@v4
176176
with:
177-
dotnet-version: 9.0.x
177+
global-json-file: application/global.json
178178

179179
- name: Restore .NET Tools
180180
working-directory: application

.github/workflows/app-gateway.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Setup .NET Core SDK
6969
uses: actions/setup-dotnet@v4
7070
with:
71-
dotnet-version: 9.0.x
71+
global-json-file: application/global.json
7272

7373
- name: Restore .NET Tools
7474
working-directory: application

.github/workflows/back-office.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: |
6060
deploy_staging="${{ github.ref == 'refs/heads/main' && vars.STAGING_CLUSTER_ENABLED == 'true' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Deploy to Staging')) }}"
6161
echo "deploy_staging=$deploy_staging" >> $GITHUB_OUTPUT
62-
62+
6363
deploy_production="${{ github.ref == 'refs/heads/main' && vars.PRODUCTION_CLUSTER1_ENABLED == 'true' }}"
6464
echo "deploy_production=$deploy_production" >> $GITHUB_OUTPUT
6565
@@ -75,7 +75,7 @@ jobs:
7575
- name: Setup .NET Core SDK
7676
uses: actions/setup-dotnet@v4
7777
with:
78-
dotnet-version: 9.0.x
78+
global-json-file: application/global.json
7979

8080
- name: Restore .NET Tools
8181
working-directory: application
@@ -174,7 +174,7 @@ jobs:
174174
- name: Setup .NET Core SDK
175175
uses: actions/setup-dotnet@v4
176176
with:
177-
dotnet-version: 9.0.x
177+
global-json-file: application/global.json
178178

179179
- name: Restore .NET Tools
180180
working-directory: application

.github/workflows/pull-request-conventions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
# Check if description contains the phrase "pull request"
7272
DESCRIPTION=$(gh pr view $PULL_REQUEST_NUMBER --json body -q '.body' --repo $GITHUB_REPOSITORY)
7373
DESCRIPTION_LOWER="${DESCRIPTION,,}"
74-
74+
7575
if echo "$DESCRIPTION_LOWER" | grep -qiE 'pull(-)?request\b'; then
7676
echo "❌ Pull request description should not contain the phrase 'pull request' or 'pull-request'"
7777
EXIT_CODE=1
@@ -87,7 +87,7 @@ jobs:
8787
echo "❌ Please check the box: 'I have added tests, or done manual regression tests'"
8888
EXIT_CODE=1
8989
fi
90-
90+
9191
if ! echo "$DESCRIPTION" | grep -q "\- \[x\] I have updated the documentation, if necessary"; then
9292
echo "❌ Please check the box: 'I have updated the documentation, if necessary'"
9393
EXIT_CODE=1

0 commit comments

Comments
 (0)