NewBuild #57
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: NewBuild | |
on: | |
schedule: | |
- cron: '59 23 * * 0' | |
workflow_dispatch: | |
jobs: | |
# This job tries to run the prerequisites, just to see if this works | |
TryInit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checking-out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: Show Info | |
run: dotnet --info | |
- name: Receive Versions | |
run: perl ".github/workflows/UpdateVersions.pl" "." | |
# This is a job to try to build backports with a garbage version number, just to see if building fails | |
TryBuildBackports: | |
needs: TryInit | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
csproj-file: | |
- 'Backports/Backports.csproj' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- run: dotnet restore "${{ matrix.csproj-file }}" | |
- run: dotnet build "${{ matrix.csproj-file }}" --no-restore --configuration Release | |
# this is the real job needed to build and publish | |
BuildAndPublishExtensions: | |
needs: TryBuildBackports | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
csproj-file: | |
- 'Backports/Backports.csproj' | |
- 'Corlib.Extensions/Corlib.Extensions.csproj' | |
- 'PresentationCore.Extensions/PresentationCore.Extensions.csproj' | |
- 'System.Drawing.Extensions/System.Drawing.Extensions.csproj' | |
- 'System.Windows.Forms.Extensions/System.Windows.Forms.Extensions.csproj' | |
- 'System.DirectoryServices.AccountManagement.Extensions/DirectoryServices.Extensions.csproj' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- run: | | |
projectDir=$(dirname ${{ matrix.csproj-file }}) | |
projectName=$(basename $projectDir) | |
echo "ProjectDir=$projectDir" >> $GITHUB_ENV | |
echo "ProjectName=$projectName" >> $GITHUB_ENV | |
- run: perl ".github/workflows/UpdateVersions.pl" "." | |
- run: dotnet restore "${{ matrix.csproj-file }}" | |
- run: dotnet build "${{ matrix.csproj-file }}" --no-restore --configuration Release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.ProjectName}} | |
path: ${{env.ProjectDir}}/bin/Release | |
- name: Pack NuGet package | |
run: dotnet pack "${{ matrix.csproj-file }}" --configuration Release --output ./artifacts | |
- name: Publish the package to nuget.org | |
run: dotnet nuget push ./artifacts/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json --skip-duplicate | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} |