From a0a4d4ccb4e02d80a57359328a4bc56b79eed22e Mon Sep 17 00:00:00 2001 From: Michael Fyffe <6224270+TraGicCode@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:14:30 -0600 Subject: [PATCH] (GH-17) Automate dotnet-tool release Closes #17 --- .github/workflows/docker_build.yml | 6 ++- .github/workflows/dotnet_tool_build.yml | 7 ++- .github/workflows/release.yml | 48 ++++++++++++++++++++ .github/workflows/release_prep.yml | 4 +- src/BuslyCLI.Console/BuslyCLI.Console.csproj | 4 +- website/docs/getting-started/quick-start.mdx | 3 +- 6 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 138315e..c9ce741 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -1,7 +1,11 @@ name: Build Docker Image on: - workflow_dispatch: + workflow_call: + inputs: + version: + required: true + type: string jobs: build: diff --git a/.github/workflows/dotnet_tool_build.yml b/.github/workflows/dotnet_tool_build.yml index 6c0fb20..864db78 100644 --- a/.github/workflows/dotnet_tool_build.yml +++ b/.github/workflows/dotnet_tool_build.yml @@ -1,7 +1,12 @@ name: Build and Publish .NET Tool on: - workflow_dispatch: + workflow_call: + inputs: + version: + required: true + type: string + jobs: build-and-pack: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1851435 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +on: + workflow_dispatch: {} + +jobs: + get-version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.changelog.outputs.version }} + steps: + - uses: actions/checkout@v4 + + - name: Extract version from CHANGELOG.md + id: changelog + run: | + version=$(grep -m 1 -oP '^##\s*\[\K[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md) + echo "version=$version" >> $GITHUB_OUTPUT + tag: + needs: get-version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Create and push git tag + run: | + version=${{ needs.get-version.outputs.version }} + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git tag "v$version" + git push origin "v$version" + docker: + needs: get-version + uses: ./.github/workflows/docker_build.yml + with: + version: ${{ needs.get-version.outputs.version }} + secrets: inherit + + nuget: + needs: get-version + uses: ./.github/workflows/dotnet_tool_build.yml + with: + version: ${{ needs.get-version.outputs.version }} + secrets: inherit diff --git a/.github/workflows/release_prep.yml b/.github/workflows/release_prep.yml index 5e3ece8..f3feed3 100644 --- a/.github/workflows/release_prep.yml +++ b/.github/workflows/release_prep.yml @@ -30,8 +30,8 @@ jobs: - name: "commit changes" run: | - git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com" - git config --local user.name "GitHub Actions" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" git add . git commit -m "Release prep v${{ github.event.inputs.version }}" diff --git a/src/BuslyCLI.Console/BuslyCLI.Console.csproj b/src/BuslyCLI.Console/BuslyCLI.Console.csproj index d86f33f..f80ed53 100644 --- a/src/BuslyCLI.Console/BuslyCLI.Console.csproj +++ b/src/BuslyCLI.Console/BuslyCLI.Console.csproj @@ -7,8 +7,8 @@ BuslyCLI true - dotnet-busly-cli - busly-cli + dotnet-busly + dotnet-busly diff --git a/website/docs/getting-started/quick-start.mdx b/website/docs/getting-started/quick-start.mdx index 1068d7e..b36176f 100644 --- a/website/docs/getting-started/quick-start.mdx +++ b/website/docs/getting-started/quick-start.mdx @@ -32,7 +32,8 @@ docker run --rm tragiccode/busly-cli --help ```bash -dotnet tool install --global dotnet-busly-cli +dotnet tool install --global dotnet-busly +dotnet-busly --help ```