Skip to content

target supported version #36

target supported version

target supported version #36

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: "target supported version"
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the default branch
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: "STS"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
version-sweep:
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
# Runs a single command using the runners shell
- name: "Print manual run reason"
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo 'Reason: ${{ github.event.inputs.reason }}'
# Start the .NET version sweeper, scan projects/slns for non-LTS (or currrent) versions
- name: .NET version sweeper
id: dotnet-version-sweeper
uses: dotnet/versionsweeper@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
owner: ${{ github.repository_owner }}
name: ${{ github.repository }}
branch: ${{ github.ref }}
- name: Create pull requests
if: steps.dotnet-version-sweeper.outputs.has-remaining-work == 'true'
run: |
upgradeProjects: ${{ steps.dotnet-version-sweeper.outputs.upgradeProjects }}
# 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 ${{ inputs.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