forked from andrewjsaid/builderbuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (92 loc) · 3.42 KB
/
version_sweeper.yml
File metadata and controls
105 lines (92 loc) · 3.42 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: .NET version sweeper
defaults:
run:
# bash --noprofile --norc -e(o) pipefail {0}
shell: bash
on:
schedule:
- cron: 0 0 1 * *
workflow_dispatch:
inputs:
reason:
description: The reason for running the workflow
required: true
default: Manual run
support:
description: The support level to target (STS, LTS, or Preview).
required: true
default: LTS
concurrency:
# github.event.pull_request.number || github.ref: pull request number or branch name if not a pull request
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CHECK_PERMISSIONS: 0
permissions: {}
jobs:
version-sweep:
name: Sweep .NET Versions
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
issues: write # Need to create issue
contents: write # Need to commit changes
pull-requests: write # Need to create PR
steps:
- id: check-permissions
name: Check action permissions
uses: GitHubSecurityLab/actions-permissions/monitor@bf82d13b9b10051d224345ab9184f5ede0a94289 # v1.0.2-beta9
if: env.CHECK_PERMISSIONS == '1'
- id: checkout-repo
name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: true # Need to push changes
- id: print-reason
name: Print manual run reason
env:
REASON: ${{ github.event.inputs.reason }}
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "Reason: $REASON"
# Issues will be automatically created for any non-ignored projects that are targeting non-LTS versions
- id: dotnet-version-sweeper
name: .NET version sweeper
uses: dotnet/versionsweeper@4db106fb89f4c6191a1e3901f953b1aae05331b5 # v4.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
owner: ${{ github.repository_owner }}
name: ${{ github.repository }}
branch: ${{ github.ref }}
sdkCompliance: true
- id: create-prs
name: Create pull requests
if: steps.dotnet-version-sweeper.outputs.has-remaining-work == 'true'
env:
UPGRADE_PROJECTS: ${{ steps.dotnet-version-sweeper.outputs.upgrade-projects }}
SUPPORT: ${{ inputs.support }}
DOTNET_CLI_TELEMETRY_OPTOUT: true
run: |
upgradeProjects="$UPGRADE_PROJECTS"
# Install .NET Upgrade Assistant global tool
dotnet tool install --global upgrade-assistant
# Iterate all upgrade projects
for projectDir in "${upgradeProjects[@]}"; do
echo "Project Directory: $projectDir"
# Create a new branch
git checkout -b upgrade/$projectDir
# Perform the upgrade using upgrade-assistant
upgrade-assistant upgrade "$projectDir" --non-interactive -t "$SUPPORT"
# Commit the changes
git add .
git commit -m ".NET Version Sweeper: Upgraded $projectDir"
# Push the branch to the repository
git push origin upgrade/$projectDir
# Create a pull request
gh pr create \
--base main \
--head upgrade/$projectDir \
--title "Upgraded $projectDir" \
--body "Proposed upgrade for $projectDir"
done