diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4155cf4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build-and-test: + runs-on: windows-latest + if: "!startsWith(github.event.head_commit.message, 'chore(release):')" + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + + - name: Restore dependencies + run: dotnet restore VStudio.slnx + + - name: Build + run: dotnet build VStudio.slnx --no-restore + + - name: Test + run: dotnet test VStudio.slnx --no-build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..833ea0b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: Publish to NuGet + +on: + push: + tags: ['v*'] + +jobs: + publish: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + + - name: Restore dependencies + run: dotnet restore VStudio.slnx + + - name: Build + run: dotnet build VStudio.slnx --no-restore + + - name: Test + run: dotnet test VStudio.slnx --no-build + + - name: Extract version from tag + id: version + run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT + shell: bash + + - name: Pack + run: dotnet pack src/VStudio.CLI/VStudio.CLI.csproj --no-build -p:Version=${{ steps.version.outputs.VERSION }} -o ./nupkg + + - name: Push to NuGet + run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2691b56 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + branches: [main] + +jobs: + release: + runs-on: windows-latest + if: "!startsWith(github.event.head_commit.message, 'chore(release):')" + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GH_PAT }} + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + + - name: Install Versionize + run: dotnet tool install --global Versionize + + - name: Configure git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Run Versionize + id: versionize + run: versionize --skip-dirty + continue-on-error: true + + - name: Push changes + if: steps.versionize.outcome == 'success' + run: git push --follow-tags diff --git a/.versionize b/.versionize new file mode 100644 index 0000000..ab85a7c --- /dev/null +++ b/.versionize @@ -0,0 +1,8 @@ +{ + "projects": [ + { + "name": "VStudio.CLI", + "path": "src/VStudio.CLI/VStudio.CLI.csproj" + } + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..d8249f7 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# vstudio + +A .NET global tool that opens Visual Studio solution files from the command line. + +## Installation + +``` +dotnet tool install --global vstudio +``` + +## Usage + +``` +vstudio . # find and open a solution in the current directory +vstudio ./path/to/dir # find and open a solution in a given directory +vstudio ./path/to/MyApp.sln # open a specific solution file directly +``` + +## Uninstall + +``` +dotnet tool uninstall --global vstudio +``` diff --git a/src/VStudio.CLI/VStudio.CLI.csproj b/src/VStudio.CLI/VStudio.CLI.csproj index 038a981..5545bc2 100644 --- a/src/VStudio.CLI/VStudio.CLI.csproj +++ b/src/VStudio.CLI/VStudio.CLI.csproj @@ -1,10 +1,26 @@ - + Exe net10.0 enable enable + + + true + vstudio + ./nupkg + + + vstudio + 0.1.0 + dulait + A .NET global tool that opens Visual Studio solution files from the command line. + MIT + visual-studio;cli;developer-tools;dotnet-tool + https://github.com/dulait/vstudio + https://github.com/dulait/vstudio + README.md @@ -15,4 +31,8 @@ + + + +