This repository has been archived by the owner on May 9, 2024. It is now read-only.
CI #34
Workflow file for this run
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: CI | |
on: | |
create: | |
branches: | |
- release/** | |
push: | |
branches: | |
- master | |
- dev/** | |
paths: | |
- ColorPicker.Maui/** | |
- ColorPicker.Maui.Tests/** | |
- .github/workflows/ci.yml | |
- README.md | |
- LICENSE.md | |
pull_request: | |
branches: | |
- master | |
paths: | |
- ColorPicker.Maui/** | |
- ColorPicker.Maui.Tests/** | |
- .github/workflows/ci.yml | |
- README.md | |
- LICENSE.md | |
jobs: | |
build: | |
env: | |
BUILD_CONFIG: 'Release' | |
# Avoid building the app as building Android and iOS apps in Release mode is expensive. | |
SOLUTION: 'ColorPicker.Maui.NoApp.sln' | |
PROJECT_NAME: 'ColorPicker.Maui' | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
contents: write # to push to gh-pages branch | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
- name: Setup NuGet | |
uses: NuGet/[email protected] | |
- name: Restore dependencies | |
run: nuget restore $env:SOLUTION | |
- name: Setup .NET | |
run: | | |
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1' | |
./dotnet-install.ps1 -Channel Current | |
shell: pwsh | |
- name: Setup MSBuild | |
uses: microsoft/[email protected] | |
- name: Build | |
run: msbuild $env:SOLUTION /p:Configuration=$env:BUILD_CONFIG /p:Platform="Any CPU" -p:Version=${{ steps.gitversion.outputs.assemblySemVer }} | |
- name: Run tests | |
run: dotnet test $env:SOLUTION /p:Configuration=$env:BUILD_CONFIG /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --no-restore --no-build -l "console;verbosity=detailed" | |
- name: Download live-documenter | |
uses: robinraju/[email protected] | |
with: | |
repository: "barry-jones/live-documenter" | |
latest: true | |
fileName: "livedocumenter*.zip" | |
tarBall: false | |
zipBall: false | |
- name: Install live-documenter | |
run: | | |
Expand-Archive -Path livedocumenter*.zip -DestinationPath build/livedocumenter | |
shell: pwsh | |
- name: Generate documentation | |
run: | | |
# Avoid generating using the Android library as it has a lot of generated "Resources" code. | |
# We'll explicitly select the Windows target. | |
$dllName = (Get-ChildItem -Path ${{ env.PROJECT_NAME }}/bin/${{ env.BUILD_CONFIG }}/net*-windows*/ -Filter ${{ env.PROJECT_NAME }}.dll -Recurse | Select-Object -First 1 -ExpandProperty FullName) | |
./build/livedocumenter/exporter/net471/exporter $dllName -to ./build/docs -format web-refresh.ldec | |
mv "./build/docs/LD Export*" "./build/docs/web" | |
shell: pwsh | |
- name: Deploy documentation to GitHub pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build/docs/web | |
- name: Publish documentation artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: docs.${{ steps.gitversion.outputs.semVer }} | |
path: ./build/docs/web/** | |
- name: Build nuget packages | |
run: msbuild -t:pack $env:SOLUTION -p:Configuration=$env:BUILD_CONFIG -p:PackageVersion=${{ steps.gitversion.outputs.semVer }} | |
- name: Move nuget packages | |
run: mkdir .nupkgs; get-childitem *.*nupkg -recurse | foreach-object {move-item $_ -destination .nupkgs} | |
shell: pwsh | |
- name: Publish nuget artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: packages.${{ steps.gitversion.outputs.semVer }} | |
path: .nupkgs/** | |
- name: Publish dev | |
if: github.ref == 'refs/heads/master' | |
run: nuget push .nupkgs\** -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} | |
- name: Publish | |
if: startsWith(github.ref, 'refs/heads/release') | |
run: nuget push .nupkgs\** -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} |