From 0d39d9b1aa70d3c287e3f7adbe135c8221778916 Mon Sep 17 00:00:00 2001 From: Lunar Starstrum Date: Tue, 12 Sep 2023 20:16:27 -0500 Subject: [PATCH] Rework action files --- .editorconfig | 15 +++- .github/workflows/build.yml | 58 +++++++++----- .github/workflows/docs.yml | 68 ----------------- .github/workflows/release.yml | 76 +++++++++++++++++++ .../DSharpPlus.VoiceLink.csproj | 5 +- 5 files changed, 133 insertions(+), 89 deletions(-) delete mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/release.yml diff --git a/.editorconfig b/.editorconfig index 18f054e..e1ae472 100644 --- a/.editorconfig +++ b/.editorconfig @@ -73,6 +73,9 @@ dotnet_style_prefer_conditional_expression_over_return = true:error # Style Definitions dotnet_naming_style.pascal_case_style.capitalization = pascal_case +dotnet_naming_style.camel_case_with_underscore.capitalization = camel_case +dotnet_naming_style.camel_case_with_underscore.required_prefix = _ +dotnet_naming_style.camel_case_with_underscore.word_separator = # Use PascalCase for constant fields dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = error @@ -99,6 +102,16 @@ dotnet_naming_style.async_suffix.capitalization = pascal_case dotnet_naming_symbols.async_methods.applicable_kinds = method dotnet_naming_symbols.async_methods.required_modifiers = async +# Enforce private or internal properties/fields to start with a '_' and be camelcased +dotnet_naming_rule.camel_case_private_internal_fields_with_underscore.severity = suggestion +dotnet_naming_rule.camel_case_private_internal_fields_with_underscore.symbols = private_internal_fields +dotnet_naming_rule.camel_case_private_internal_fields_with_underscore.style = camel_case_with_underscore +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field, property +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal +dotnet_naming_symbols.private_internal_fields.required_modifiers = private, internal +dotnet_naming_symbols.private_internal_fields.required_prefix = _ +dotnet_naming_symbols.private_internal_fields.required_style = camel_case + # Don't force namespaces to match their folder names dotnet_diagnostic.IDE0130.severity = none @@ -172,4 +185,4 @@ csharp_space_between_method_call_empty_parameter_list_parentheses = false # Wrapping preferences csharp_preserve_single_line_statements = true -csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_blocks = true \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec3f928..177a53c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,19 +1,15 @@ -name: .NET Build +name: Build Commit + on: push: paths: - - 'docs/**' - - 'src/**' - - 'libs/**' - - 'examples/**' - - 'tools/**' - pull_request: - paths: - - 'docs/**' - - 'src/**' - - 'libs/**' - - 'examples/**' - - 'tools/**' + - ".github/workflows/build-commit.yml" + - "docs/**" + - "libs/**" + - "src/**" + - "tools/**" + - "*.sln" + workflow_dispatch: env: DOTNET_NOLOGO: 1 @@ -22,19 +18,43 @@ env: DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1 jobs: - build_and_publish: - name: Build + build_commit: + name: Build Commit runs-on: self-hosted if: "!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[ci-skip]')" steps: - name: Checkout uses: actions/checkout@v3 with: - fetch-depth: '0' submodules: recursive - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7 - - name: Build - run: "dotnet build" \ No newline at end of file + dotnet-version: | + 8 + 7 + - name: Build Project + run: dotnet build + document_commit: + name: Document Commit + runs-on: self-hosted + needs: build_commit + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Install DocFX + run: dotnet tool update -g docfx --prerelease + continue-on-error: true + - name: Build documentation + run: docfx docs/docfx.json + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v1 + with: + path: ./docs/_site/ + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 1f6c062..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: .NET Docs -on: - release: - types: - - published - workflow_dispatch: - push: - paths: - - 'docs/**' - - 'src/**' - - 'libs/**' - - '.github/workflows/docs.yml' - branches: - - master - -env: - DOTNET_NOLOGO: 1 - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1 - -permissions: - contents: write - -jobs: - generate-docs: - name: Generate Docs - runs-on: self-hosted - if: "!contains(format('{0} {1}', github.event.head_commit.message, github.event.pull_request.title), '[ci-skip]')" - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: '0' - submodules: recursive - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 7 - - name: Install DocFX - run: dotnet tool install -g docfx - continue-on-error: true - - name: Build documentation - run: docfx docs/docfx.json - - name: Upload GitHub Pages artifact - uses: actions/upload-pages-artifact@v1 - with: - # Path of the directory containing the static assets. - path: ./docs/_site/ # default is _site/ - - deploy: - name: Deploy to GitHub Pages - # Add a dependency to the build job - needs: generate-docs - # Grant GITHUB_TOKEN the permissions required to make a Pages deployment - permissions: - pages: write # to deploy to Pages - id-token: write # to verify the deployment, originates from an appropriate source - # Deploy to the github-pages environment - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - # Specify runner + deployment step - runs-on: self-hosted - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..907684c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,76 @@ +name: Publish Release + +on: + release: + types: + - "published" + push: + paths: + - ".github/workflows/release.yml" + - "Directory.Build.props" + - "*.sln" + - "*.csproj" + +env: + DOTNET_NOLOGO: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1 + +jobs: + publish_release: + name: Publish Release + runs-on: "self-hosted" + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 8 + 7 + - name: Build and Publish + run: | + mkdir build + dotnet pack -c Release -o build /p:Version=${{ github.event.release.tag_name }} + if [ -n "${{ github.event.release.name }}" ]; then + dotnet nuget push "build/*" --skip-duplicate -k ${{ secrets.NUGET_ORG_API_KEY }} -s https://api.nuget.org/v3/index.json + fi + dotnet tool update -g docfx --prerelease + docfx docs/docfx.json + - name: Upload NuGet packages to GitHub Actions + uses: actions/upload-artifact@v3 + with: + name: DSharpPlus.VoiceLink Release ${{ github.event.release.name }} NuGet Packages.zip + path: build/* + - name: Upload NuGet Packages To GitHub Release + uses: "ncipollo/release-action@v1" + if: github.event.release.name != null + with: + allowUpdates: true + artifactErrorsFailBuild: true + artifacts: "build/*" + token: ${{ secrets.GITHUB_TOKEN }} + omitNameDuringUpdate: true # We don't want to update the name of the release. + omitBodyDuringUpdate: true # We don't want to update the body of the release. + document_commit: + name: Document Commit + runs-on: self-hosted + needs: publish_release + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v1 + with: + path: ./docs/_site/ + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/src/DSharpPlus.VoiceLink/DSharpPlus.VoiceLink.csproj b/src/DSharpPlus.VoiceLink/DSharpPlus.VoiceLink.csproj index 8e7ba50..31da3d3 100644 --- a/src/DSharpPlus.VoiceLink/DSharpPlus.VoiceLink.csproj +++ b/src/DSharpPlus.VoiceLink/DSharpPlus.VoiceLink.csproj @@ -2,6 +2,9 @@ OoLunar.DSharpPlus.VoiceLink An updated voice extension for the DSharpPlus Discord library. - true + false + + + \ No newline at end of file