Skip to content

Commit

Permalink
Set version to global.json
Browse files Browse the repository at this point in the history
  • Loading branch information
xperiandri committed Feb 25, 2024
1 parent 96caa76 commit 246d6c0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/publish_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- dev

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true

jobs:
publish:

Expand All @@ -25,6 +29,19 @@ jobs:
echo "VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh

- name: Add version to global.json
run: |
$version = "7.0.406"
$globalJsonPath = "global.json"
$globalJson = Get-Content -Raw -Path $globalJsonPath | ConvertFrom-Json
if ($null -eq $globalJson.sdk.version) {
$globalJson.sdk | Add-Member -Type NoteProperty -Name version -Value $version
} else {
$globalJson.sdk.version = $version
}
$globalJson | ConvertTo-Json -Depth 10 | Set-Content -Path $globalJsonPath
shell: pwsh

- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
tags:
- 'releases/*'

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -27,6 +31,19 @@ jobs:
echo "VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh

- name: Add version to global.json
run: |
$version = "7.0.406"
$globalJsonPath = "global.json"
$globalJson = Get-Content -Raw -Path $globalJsonPath | ConvertFrom-Json
if ($null -eq $globalJson.sdk.version) {
$globalJson.sdk | Add-Member -Type NoteProperty -Name version -Value $version
} else {
$globalJson.sdk.version = $version
}
$globalJson | ConvertTo-Json -Depth 10 | Set-Content -Path $globalJsonPath
shell: pwsh

- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
- master
- dev

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true

jobs:
build:

Expand All @@ -28,6 +32,19 @@ jobs:
with:
dotnet-version: ${{ matrix.dotnet }}

- name: Add version to global.json
run: |
$version = "${{ matrix.dotnet }}"
$globalJsonPath = "global.json"
$globalJson = Get-Content -Raw -Path $globalJsonPath | ConvertFrom-Json
if ($null -eq $globalJson.sdk.version) {
$globalJson.sdk | Add-Member -Type NoteProperty -Name version -Value $version
} else {
$globalJson.sdk.version = $version
}
$globalJson | ConvertTo-Json -Depth 10 | Set-Content -Path $globalJsonPath
shell: pwsh

- name: Install local tools
run: dotnet tool restore

Expand Down

0 comments on commit 246d6c0

Please sign in to comment.