Bump Microsoft.NET.Test.Sdk from 17.12.0 to 17.13.0 in /src #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automatic Release | |
on: | |
pull_request: | |
types: closed | |
defaults: | |
run: | |
shell: pwsh | |
permissions: | |
contents: write | |
env: | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
auto-release: | |
name: Automatic Release | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout required for GitHub CLI to work | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
# Need history for git diff to work | |
fetch-depth: 0 | |
- name: Determine if auto-release is necessary | |
run: | | |
# Script checks the diff of src/Particular.PlatformSample/Particular.PlatformSample.csproj in the just-merged PR, and invokes a release of the next minor if ServiceControl/ServicePulse changes | |
# Get the diff of the component csproj file between the base and head of the just-merged PR | |
$diff = $(git diff ${{ github.event.pull_request.base.sha }} HEAD src/Particular.PlatformSample/Particular.PlatformSample.csproj ) | |
# Grep search for lines that show an addition contianing ServiceControl/ServicePulse | |
$updates = $diff | grep -E '^\+\s+<PackageReference Include="Particular\.PlatformSample\.(ServiceControl|ServicePulse)"' | |
echo "Result of search for ServiceControl/ServicePulse updates in PR diff" | |
echo $updates | |
# Get number of lines | |
$lines = ($updates | Measure-Object -Line).Lines | |
if ($lines -eq 0) { | |
echo "Nothing to release" | |
exit 0 | |
} | |
echo "Change to ServiceControl/ServicePulse detected, need to release" | |
$tags = gh api /repos/${{ github.repository }}/tags | ConvertFrom-Json | |
$latest = [Version]($tags | Where-Object name -match '^\d+\.\d+\.\d+$' | Sort-Object -Descending {[Version]$_.name} | Select-Object name)[0].name | |
$nextMinor = "$($latest.Major).$($latest.Minor + 1).0" | |
echo "Latest release is $latest, next release should be $nextMinor" | |
echo "Triggering release of $nextMinor using GitHub CLI" | |
gh release create $nextMinor --latest --notes "Automatically generated due to updates in ServiceControl/ServicePulse" | |
echo "Release triggered, complete" | |
exit 0 | |