Merge pull request #15 from Foxtrek64/main #68
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: .NET | |
env: | |
GITHUB_USER: Nihlus | |
GITHUB_FEED: https://nuget.pkg.github.com/Remora | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
on: | |
- push | |
- pull_request | |
jobs: | |
build: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{matrix.platform}} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Build | |
run: | | |
dotnet restore | |
dotnet build -c Release --no-restore | |
- name: Package | |
if: matrix.platform == 'ubuntu-latest' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: dotnet pack -c Release --no-restore --no-build --version-suffix "github$GITHUB_RUN_ID" | |
- uses: actions/upload-artifact@v3 | |
if: matrix.platform == 'ubuntu-latest' | |
with: | |
name: nupkg | |
path: nuget/* | |
prerelease: | |
needs: build | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download package artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: nupkg | |
path: nuget | |
# To ensure that the current version being pushed does not get pruned we prune first. | |
- name: Prune packages older than 4 versions (new version is the 5th) | |
uses: smartsquaregmbh/delete-old-packages@v0.4.0 | |
with: | |
keep: 4 | |
names: | | |
Remora.Sdk | |
Remora.Tests.Sdk | |
- name: Push to GitHub Feed | |
run: | | |
for f in ./nuget/*; do | |
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED | |
done |