Merge pull request #26 from kevbite/dotnet-9 #60
This file contains hidden or 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: Continuous Integration Workflow | |
on: [push] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
VERSION: 0.0.${{ github.run_number }} | |
RUN_DEPLOY: ${{ matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Install PDFtk Server CLI | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: sudo apt-get install pdftk | |
- name: Install PDFtk Server CLI | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 | |
choco install pdftk-server | |
echo "C:\Program Files (x86)\PDFtk Server\bin\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- uses: actions/checkout@v4 | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup .NET 9 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release -p:Version=${{ env.VERSION }} --no-restore | |
- name: Pack | |
run: dotnet pack --configuration Release -p:Version=${{ env.VERSION }} --no-build --output ./artifacts --verbosity normal | |
- name: Test | |
run: dotnet test --configuration Release --no-build --verbosity normal | |
- name: NuGet.Org push | |
if: ${{ fromJSON(env.RUN_DEPLOY) }} | |
run: | | |
dotnet nuget push ./artifacts/*.nupkg --source NuGet.org --api-key ${{ secrets.NUGET_API_KEY }} | |
- name: Upload Release Asset | |
if: ${{ fromJSON(env.RUN_DEPLOY) }} | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
files: | | |
./artifacts/*.nuget | |