-
-
Notifications
You must be signed in to change notification settings - Fork 4
82 lines (67 loc) · 2.5 KB
/
Copy pathupdate-dotnet-sdk.yml
File metadata and controls
82 lines (67 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: update-dotnet-sdk
on:
schedule:
- cron: '00 19 * * TUE'
workflow_dispatch:
permissions:
contents: read
jobs:
update-sdk:
uses: martincostello/update-dotnet-sdk/.github/workflows/update-dotnet-sdk.yml@ff9a6f247704ef1b77eb3c478070d8fa69c2360e # v2.2.3
with:
labels: "dependencies,.NET"
user-email: ${{ vars.GIT_COMMIT_USER_EMAIL }}
user-name: ${{ vars.GIT_COMMIT_USER_NAME }}
secrets:
repo-token: ${{ secrets.ACCESS_TOKEN }}
update-signalr:
needs: update-sdk
runs-on: ubuntu-latest
if : ${{ needs.update-sdk.outputs.sdk-updated == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ needs.update-sdk.outputs.branch-name }}
token: ${{ secrets.ACCESS_TOKEN }}
- name: Setup Node
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: '18'
- name: Update SignalR npm package
shell: pwsh
run: |
$package = "@microsoft/signalr"
$channel = (Get-Content .\global.json | ConvertFrom-Json).sdk.version.Split('.')[0]
$newVersion = (npm view $package versions --json | ConvertFrom-Json | Where { $_ -Like "$channel*" } | Sort-Object -Descending)[0]
Push-Location "./src/Costellobot"
$currentVersion = (Get-Content .\package.json | ConvertFrom-Json).dependencies.$package.TrimStart('^')
if ($currentVersion -ne $newVersion) {
$packageVersion = "${package}@${newVersion}"
npm install $packageVersion
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to install $packageVersion."
exit $LASTEXITCODE
}
Pop-Location
$commitMessageLines = @(
"Bump ${package} from ${currentVersion} to ${newVersion}",
"",
"Bumps ${package} from ${currentVersion} to ${newVersion}.",
"",
"---",
"updated-dependencies:",
"- dependency-name: ${package}",
" dependency-type: direct:production",
" update-type: version-update:semver-patch",
"...",
"",
""
)
$commitMessage = $commitMessageLines -join "`n"
git config user.email "${{ vars.GIT_COMMIT_USER_EMAIL }}"
git config user.name "${{ vars.GIT_COMMIT_USER_NAME }}"
git add .
git commit -m $commitMessage -s
git push
}