Skip to content

Commit

Permalink
Rework action files
Browse files Browse the repository at this point in the history
  • Loading branch information
OoLunar committed Sep 13, 2023
1 parent adbb06c commit 0d39d9b
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 89 deletions.
15 changes: 14 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
58 changes: 39 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
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
68 changes: 0 additions & 68 deletions .github/workflows/docs.yml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion src/DSharpPlus.VoiceLink/DSharpPlus.VoiceLink.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<PropertyGroup>
<PackageId>OoLunar.DSharpPlus.VoiceLink</PackageId>
<Description>An updated voice extension for the DSharpPlus Discord library.</Description>
<IsPackable>true</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DSharpPlus" Version="4.4.2" />
</ItemGroup>
</Project>

0 comments on commit 0d39d9b

Please sign in to comment.