Skip to content

Commit 0f6a449

Browse files
authored
Merge pull request #1 from matt-goldman/copilot/add-console-app-global-tool
Implement DeepClean: Cross-platform dotnet global tool for cleaning bin/obj folders
2 parents 8e958c5 + aed5d86 commit 0f6a449

File tree

5 files changed

+553
-2
lines changed

5 files changed

+553
-2
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
permissions:
12+
contents: read
13+
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
17+
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: '9.0.x'
27+
28+
- name: Restore dependencies
29+
run: dotnet restore DeepClean/DeepClean.csproj
30+
31+
- name: Build
32+
run: dotnet build DeepClean/DeepClean.csproj -c Release --no-restore
33+
34+
- name: Test
35+
run: dotnet test DeepClean/DeepClean.csproj -c Release --no-build --verbosity normal
36+
continue-on-error: true # Continue even if no tests exist
37+
38+
- name: Test dry-run (Unix)
39+
if: matrix.os != 'windows-latest'
40+
run: |
41+
cd DeepClean
42+
dotnet run -- --dry-run
43+
44+
- name: Test dry-run (Windows)
45+
if: matrix.os == 'windows-latest'
46+
run: |
47+
cd DeepClean
48+
dotnet run -- --dry-run

.github/workflows/publish.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish to NuGet
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Package version to publish'
10+
required: true
11+
type: string
12+
13+
jobs:
14+
publish:
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v4
26+
with:
27+
dotnet-version: '9.0.x'
28+
29+
- name: Restore dependencies
30+
run: dotnet restore DeepClean/DeepClean.csproj
31+
32+
- name: Build
33+
run: dotnet build DeepClean/DeepClean.csproj -c Release --no-restore
34+
35+
- name: Test
36+
run: dotnet test DeepClean/DeepClean.csproj -c Release --no-build --verbosity normal
37+
continue-on-error: true # Continue even if no tests exist
38+
39+
- name: Update version from tag
40+
if: github.event_name == 'release'
41+
run: |
42+
VERSION=${GITHUB_REF#refs/tags/v}
43+
sed -i "s/<Version>.*<\/Version>/<Version>$VERSION<\/Version>/" DeepClean/DeepClean.csproj
44+
45+
- name: Update version from input
46+
if: github.event_name == 'workflow_dispatch'
47+
run: |
48+
VERSION=${{ github.event.inputs.version }}
49+
sed -i "s/<Version>.*<\/Version>/<Version>$VERSION<\/Version>/" DeepClean/DeepClean.csproj
50+
51+
- name: Pack
52+
run: dotnet pack DeepClean/DeepClean.csproj -c Release --no-build -o ./packages
53+
54+
- name: Push to NuGet
55+
run: dotnet nuget push ./packages/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
56+
env:
57+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
58+
59+
- name: Upload artifacts
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: nuget-packages
63+
path: ./packages/*.nupkg

DeepClean/DeepClean.csproj

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
9+
<!-- Global Tool Configuration -->
10+
<PackAsTool>true</PackAsTool>
11+
<ToolCommandName>deepclean</ToolCommandName>
12+
<PackageId>DeepClean</PackageId>
13+
<Version>1.0.0</Version>
14+
<Authors>Matt Goldman</Authors>
15+
<Description>A dotnet CLI tool that recursively deletes bin and obj folders from the current directory</Description>
16+
<PackageProjectUrl>https://github.com/matt-goldman/deepclean</PackageProjectUrl>
17+
<RepositoryUrl>https://github.com/matt-goldman/deepclean</RepositoryUrl>
18+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
19+
<PackageReadmeFile>README.md</PackageReadmeFile>
20+
<PackageTags>dotnet;tool;clean;bin;obj;cli</PackageTags>
21+
</PropertyGroup>
22+
23+
<ItemGroup>
24+
<None Include="../README.md" Pack="true" PackagePath="/" />
25+
</ItemGroup>
26+
27+
</Project>

0 commit comments

Comments
 (0)