Skip to content

Commit 15ef183

Browse files
authored
Housekeeping/dependabot alternative (#261)
* create a workflow to update nuget packages * disable dependabot
1 parent 0f32686 commit 15ef183

File tree

2 files changed

+81
-14
lines changed

2 files changed

+81
-14
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
55

66
version: 2
7-
updates:
8-
- package-ecosystem: nuget
9-
directory: "/"
10-
schedule:
11-
interval: "daily"
12-
groups:
13-
# Specify a name for the group, which will be used in pull request titles
14-
# and branch names
15-
Avalonia:
16-
# Define patterns to include dependencies in the group (based on
17-
# dependency name)
18-
applies-to: version-updates # Applies the group rule to version updates
19-
patterns:
20-
- "Avalonia*" # A wildcard string that matches multiple dependency names
7+
# Dependabot doesn't handle CPM yet. So we disable it for now. Instead we have a workflow file for it.
8+
9+
#updates:
10+
# - package-ecosystem: nuget
11+
# directory: "/"
12+
# schedule:
13+
# interval: "daily"
14+
# groups:
15+
# # Specify a name for the group, which will be used in pull request titles
16+
# # and branch names
17+
# Avalonia:
18+
# # Define patterns to include dependencies in the group (based on
19+
# # dependency name)
20+
# applies-to: version-updates # Applies the group rule to version updates
21+
# patterns:
22+
# - "Avalonia*" # A wildcard string that matches multiple dependency names
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
name: Update dependencies
3+
4+
on:
5+
schedule:
6+
- cron: '0 2 * * *' # Run at 02:00 every day
7+
workflow_dispatch: # Allow manual triggering
8+
9+
jobs:
10+
update-nuget:
11+
runs-on: windows-latest
12+
name: Update latest NuGets
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: '10.0.x'
21+
22+
- name: Setup Android SDK
23+
uses: actions/setup-java@v4
24+
with:
25+
distribution: 'zulu'
26+
java-version: '17'
27+
28+
- uses: android-actions/setup-android@v3
29+
30+
- name: Install workloads for Mobile and Wasm projects
31+
run: |
32+
dotnet workload restore ./src/Avalonia.Samples/CompleteApps/AdvancedToDoList/AdvancedToDoList.Android/AdvancedToDoList.Android.csproj
33+
dotnet workload restore ./src/Avalonia.Samples/CompleteApps/AdvancedToDoList/AdvancedToDoList.Browser/AdvancedToDoList.Browser.csproj
34+
dotnet workload restore ./src/Avalonia.Samples/CompleteApps/AdvancedToDoList/AdvancedToDoList.iOS/AdvancedToDoList.iOS.csproj
35+
working-directory: ./
36+
37+
- name: Install nuget update tool
38+
run: dotnet tool install --global dotnet-outdated-tool
39+
40+
- name: Run dotnet-outdated-tool
41+
run: |
42+
$solutions = Get-ChildItem -Path "./src/Avalonia.Samples" -Filter "*.sln*" -Recurse | Select-Object -ExpandProperty FullName
43+
foreach ($solution in $solutions) {
44+
dotnet outdated $solution --upgrade
45+
}
46+
shell: pwsh
47+
48+
- name: Commit and push changes
49+
run: |
50+
git config user.name "GitHub Actions"
51+
git config user.email "actions@github.com"
52+
git add .
53+
git commit -m "Update NuGet packages" || echo "No changes to commit"
54+
git push
55+
56+
- name: Create Pull Request
57+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
58+
uses: peter-evans/create-pull-request@v5
59+
with:
60+
token: ${{ secrets.GITHUB_TOKEN }}
61+
commit-message: "Update NuGet packages"
62+
title: "chore: Update NuGet packages"
63+
body: "This PR updates NuGet packages to their latest versions."
64+
branch: "update-nuget-packages"
65+
base: "main"

0 commit comments

Comments
 (0)