Skip to content

modified to work with push to main #20

modified to work with push to main

modified to work with push to main #20

Workflow file for this run

name: Publish NuGet Packages
on:
push:
branches:
- main
env:
Project_Name: Consequences/Consequences.csproj
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: '8.x'
- name: Restore dependencies
run: dotnet restore
- name: Build for Windows x64
run: dotnet publish ${{ env.PROJECT_NAME }} -c Release -r win-x64 --self-contained -p:PublishAot=true
- name: Create version number
shell: pwsh
run: |
$TAG = 0.0.0
$VERSION = $TAG -replace '^v', ''
$VERSION = "$VERSION.$env:GITHUB_RUN_NUMBER"
echo "VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Pack NuGet packages
run: dotnet pack ${{ env.PROJECT_NAME }} -c Release /p:PackageVersion=${{ env.VERSION }}
- name: Publish NuGet packages to GitHub Packages
run: dotnet nuget push **/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate
- name: Upload Windows build artifact
uses: actions/upload-artifact@v4
with:
name: windows-x64-${{ env.VERSION }}
path: |
"**/bin/Release/net8.0/win-x64/publish/"
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: '8.x'
- name: Restore dependencies
run: dotnet restore
- name: Build for Linux x64
run: dotnet publish ${{ env.PROJECT_NAME }} -c Release -r linux-x64 --self-contained -p:PublishAot=true
- name: Create version number
id: vars
run: |
TAG=$(0.0.0)
VERSION=${TAG#v}
echo "VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Pack NuGet packages
run: dotnet pack ${{ env.PROJECT_NAME }} -c Release /p:PackageVersion=${{ env.VERSION }}
- name: Publish NuGet packages to GitHub Packages
run: dotnet nuget push **/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate
- name: Upload Linux build artifact
uses: actions/upload-artifact@v4
with:
name: linux-x64-${{ env.VERSION }}
path: |
"**/bin/Release/net8.0/linux-x64/publish/"