diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..af806c4 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,75 @@ +name: Publish +on: + push: + branches: + - master +jobs: + version: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.ACTIONS_PAT }} + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + - name: Install versionize + run: dotnet tool install --global Versionize + - name: Setup git + run: | + git config --local user.email "65925598+StevanFreeborn@users.noreply.github.com" + git config --local user.name "Stevan Freeborn" + - name: Run versionize + id: versionize + run: versionize -i --exit-insignificant-commits --changelog-all --workingDir ./src/AnthropicClient --commit-suffix "[skip ci]" + continue-on-error: true + - name: Upload changelog + if: steps.versionize.outcome == 'success' + uses: actions/upload-artifact@v4 + with: + name: change-log + path: src/AnthropicClient/CHANGELOG.md + - name: Push changes to GitHub + if: steps.versionize.outcome == 'success' + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.ACTIONS_PAT }} + branch: ${{ github.ref }} + tags: true + outputs: + is_new_version: ${{ steps.versionize.outcome == 'success' }} + publish: + needs: version + if: needs.version.outputs.is_new_version == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.ref }} + token: ${{ secrets.ACTIONS_PAT }} + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + - name: Get project version + uses: kzrnm/get-net-sdk-project-versions-action@v1 + id: get-version + with: + proj-path: src/AntropicClient/AntropicClient.csproj + - name: Download changlog + uses: actions/download-artifact@v4 + with: + name: change-log + path: src/AntropicClient + - name: Create GitHub release + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.ACTIONS_PAT }} + name: AnthropicClient v${{ steps.get-version.outputs.version }} + tag_name: v${{ steps.get-version.outputs.version }} + body_path: src/AnthropicClient/CHANGELOG.md \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..839c63b --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,51 @@ +name: Pull Request +on: + pull_request: + paths-ignore: + - "**/.gitignore" + - "**/.editorconfig" + - .github/** + - .vscode/** + branches: + - master +jobs: + format: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + - name: Restore dependencies + run: dotnet restore + - name: Format code + run: dotnet format --check --verbosity diagnosticdotnet format --verify-no-changes --verbosity diagnostic + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + - name: Install report generator + run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.3.7 + - name: Restore dependencies + run: dotnet restore + - name: Run tests + env: + SKIP_EXAMPLES: true + run: dotnet test + - name: Upload html coverage report + uses: actions/upload-artifact@v4 + with: + name: html-report + path: tests/AnthropicClient.Tests/TestResults/coverage/report/ + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: tests/AnthropicClient.Tests/TestResults/coverage/coverage.cobertura.xml \ No newline at end of file diff --git a/src/AnthropicClient/AnthropicClient.csproj b/src/AnthropicClient/AnthropicClient.csproj index 6e2b388..f206358 100644 --- a/src/AnthropicClient/AnthropicClient.csproj +++ b/src/AnthropicClient/AnthropicClient.csproj @@ -6,6 +6,8 @@ AnthropicClient 0.0.0 Stevan Freeborn + README.md + CHANGELOG.md enable enable @@ -23,4 +25,9 @@ + + + + +