Wrap command line arguments in quotes #86
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: Build, Test & Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
release: | |
types: [ published ] | |
env: | |
# Disable the .NET logo in the console output. | |
DOTNET_NOLOGO: true | |
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build. | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending .NET CLI telemetry to Microsoft. | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
# Set the build number in MinVer. | |
MINVERBUILDMETADATA: build.${{github.run_number}} | |
jobs: | |
test: | |
name: Test-${{matrix.os}} | |
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c Release --no-restore | |
- name: Test | |
run: dotnet test | |
build: | |
name: Build Package | |
if: github.event_name == 'push' || github.event_name == 'release' | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c Release --no-restore | |
- name: Pack | |
run: dotnet pack -c Release --output nupkgs --no-build | |
- name: Publish Artifacts | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: "windows-latest" | |
path: "./nupkgs/*.nupkg" | |
push-github: | |
name: Push GitHub Package | |
needs: build | |
if: github.ref == 'refs/heads/main' || github.event_name == 'release' | |
environment: | |
name: "GitHub" | |
url: https://github.com/${{ github.repository }}/packages | |
permissions: | |
packages: write | |
runs-on: windows-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: "windows-latest" | |
- name: Dotnet NuGet Add Source | |
run: dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --name github --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} | |
shell: pwsh | |
- name: Dotnet NuGet Push | |
run: dotnet nuget push *.nupkg --api-key ${{ secrets.GH_PACKAGES_TOKEN }} --source github --skip-duplicate | |
shell: pwsh | |
push-nuget: | |
name: Push NuGet Package | |
needs: build | |
if: github.event_name == 'release' && !github.event.release.prerelease | |
environment: | |
name: "NuGet" | |
url: https://www.nuget.org/packages/Tailwind.MSBuild | |
runs-on: windows-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: "windows-latest" | |
- name: Dotnet NuGet Push | |
run: | | |
Get-ChildItem .\ -Filter *.nupkg | | |
Where-Object { !$_.Name.Contains('preview') } | | |
ForEach-Object { dotnet nuget push $_ --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} } | |
shell: pwsh |