Merge pull request #324 from Octol1ttle/use-extension-fromassembly #1182
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
GITHUB_USER: Nihlus | |
GITHUB_FEED: https://nuget.pkg.github.com/Remora | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
on: | |
push: | |
branches: [ main ] | |
tags: [ '*' ] | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Build | |
run: | | |
dotnet restore | |
dotnet build -c Release --no-restore | |
- name: Test | |
run: dotnet test -c Release --no-restore --no-build --verbosity minimal | |
- name: Package | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: dotnet pack -c Release --no-restore --no-build --version-suffix "github$GITHUB_RUN_ID" | |
- uses: actions/upload-artifact@v3 | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
with: | |
name: nupkg | |
path: nuget/* | |
- name: Build Docs | |
if: github.event_name == 'push' | |
run: | | |
dotnet tool restore | |
cd ./docfx | |
sed -i -E "s/%APP_VERSION%/${GITHUB_REF_NAME}/" docfx_project/docfx.json | |
dotnet docfx docfx_project/docfx.json | |
- uses: actions/upload-artifact@v3 | |
if: github.event_name == 'push' | |
with: | |
name: docfx-site | |
path: docfx/docfx_project/_site/ | |
publish_docs: | |
name: Publish Documentation | |
needs: build | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
env: | |
KEEP_TAG_VERSIONS: 5 | |
steps: | |
- name: Checkout triggering branch | |
uses: actions/checkout@v3 | |
with: | |
path: base | |
- name: Checkout gh-pages | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
path: site | |
- name: Prepare | |
run: bash base/docfx/scripts/prepare.sh | |
- name: Download documentation artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: docfx-site | |
path: site/${{ github.ref_name }} | |
- name: Build | |
run: bash base/docfx/scripts/build.sh | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./site | |
publish_prerelease_packages: | |
name: Publish Prerelease Packages | |
needs: build | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download package artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: nupkg | |
path: nuget | |
# To ensure that the current version being pushed does not get pruned we prune first. | |
- name: Prune packages older than 4 versions (new version is the 5th) | |
uses: smartsquaregmbh/[email protected] | |
with: | |
keep: 4 | |
names: | | |
Remora.Discord | |
Remora.Discord.API | |
Remora.Discord.API.Abstractions | |
Remora.Discord.Caching | |
Remora.Discord.Caching.Abstractions | |
Remora.Discord.Caching.Redis | |
Remora.Discord.Gateway | |
Remora.Discord.Extensions | |
Remora.Discord.Hosting | |
Remora.Discord.Pagination | |
Remora.Discord.Interactivity | |
Remora.Discord.Commands | |
Remora.Discord.Unstable | |
Remora.Discord.Rest | |
- name: Push to GitHub Feed | |
run: | | |
for f in ./nuget/*; do | |
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED | |
done |