Update copyright year [skipci] #118
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: MegaApiClient CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
pull_request: | |
workflow_dispatch: | |
env: | |
CONFIGURATION: Release | |
jobs: | |
build: | |
name: Build and Pack ⚙️📦 | |
runs-on: windows-latest | |
outputs: | |
semVer: ${{ steps.gitversion.outputs.semVer }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Full history is required by GitVersion | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.14 | |
with: | |
versionSpec: '5.x' | |
- name: Run GitVersion | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.9.14 | |
with: | |
updateAssemblyInfo: true | |
updateAssemblyInfoFilename: './GlobalAssemblyInfo.cs' | |
- name: Build | |
run: dotnet build --configuration ${{ env.CONFIGURATION }} ./MegaApiClient/ | |
- name: Create NuGet package | |
run: dotnet pack --configuration ${{ env.CONFIGURATION }} ./MegaApiClient/ --no-restore --no-build --output ./artifacts/ -p:PackageVersion=${{ env.GITVERSION_NUGETVERSION }} | |
- name: Upload NuGet packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: NuGet packages | |
path: ./artifacts/*.*nupkg | |
if-no-files-found: error | |
test: | |
name: Test 🧪 | |
timeout-minutes: 60 | |
runs-on: windows-latest | |
steps: | |
- name: Concurrent test execution check | |
uses: softprops/turnstyle@v1 | |
with: | |
same-branch-only: false | |
abort-after-seconds: 1800 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Tests | |
run: dotnet test --configuration ${{ env.CONFIGURATION }} ./MegaApiClient.Tests/ --framework net60 --logger "console;verbosity=detailed" --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Exclude="[MegaApiClient]BigInteger" | |
env: | |
MEGAAPICLIENT_PASSWORD: ${{ secrets.MEGAAPICLIENT_PASSWORD }} | |
- name: Codecov | |
uses: codecov/codecov-action@v2 | |
doc: | |
name: Documentation 📚 | |
needs: [ build ] | |
runs-on: windows-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install DocFX | |
run: nuget install docfx.console -Version 2.58.9 | |
- name: Build documentation | |
run: | | |
./docfx.console.2.58.9/tools/docfx.exe metadata ./docs/docfx.json | |
./docfx.console.2.58.9/tools/docfx.exe build ./docs/docfx.json --globalMetadata "{'_appFooter': 'Copyright © 2013-2024 - Gregoire Pailler - MegaApiClient ${{ needs.build.outputs.semVer }}'}" | |
- name: Upload Documentation | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Documentation | |
path: ./docs/_site/ | |
if-no-files-found: error | |
deploy: | |
name: Deploy 🚀 | |
needs: [ build, test, doc ] | |
runs-on: windows-latest | |
steps: | |
- name: Download NuGet packages | |
uses: actions/download-artifact@v3 | |
with: | |
name: NuGet packages | |
path: ./artifacts/ | |
- name: Publish on MyGet | |
run: | | |
cd ./artifacts/ | |
dotnet nuget push *.nupkg --source https://www.myget.org/F/megaapiclient/api/v3/index.json --api-key ${{ secrets.MYGET_SECRET }} | |
deploy-release: | |
name: Deploy release 🚀🌐 | |
needs: [ build, test, doc ] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Download NuGet packages | |
uses: actions/download-artifact@v2 | |
with: | |
name: NuGet packages | |
path: ./artifacts/ | |
- name: Download Documentation | |
uses: actions/download-artifact@v2 | |
with: | |
name: Documentation | |
path: ./docs/_site/ | |
- name: Publish Documentation | |
uses: JamesIves/github-pages-deploy-action@4.1.0 | |
with: | |
branch: gh-pages | |
folder: ./docs/_site/ | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: ./artifacts/*.nupkg | |
draft: true | |
- name: Publish on NuGet | |
run: | | |
cd ./artifacts/ | |
dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_SECRET }} |