Skip to content

bytes

bytes #1

Workflow file for this run

name: CI

Check failure on line 1 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

(Line: 108, Col: 11): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.NUGET_API_KEY != ''
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NUGET_DIRECTORY: ${{ github.workspace }}/nuget
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
dotnet-version: ['8.0.x', '9.0.x']
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal --logger "console;verbosity=detailed" --collect:"XPlat Code Coverage"
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.dotnet-version == '9.0.x'
uses: codecov/codecov-action@v4
with:
file: '**/coverage.cobertura.xml'
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
pack:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Get version
id: version
run: |
VERSION=$(date +%Y.%m.%d)-preview.${{ github.run_number }}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Pack
run: dotnet pack --configuration Release /p:Version=${{ steps.version.outputs.VERSION }} --output ${{ env.NUGET_DIRECTORY }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NUGET_DIRECTORY }}/*.nupkg
publish-preview:
runs-on: ubuntu-latest
needs: pack
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
packages: write
contents: read
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NUGET_DIRECTORY }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Publish to GitHub Packages
run: |
for file in ${{ env.NUGET_DIRECTORY }}/*.nupkg
do
dotnet nuget push "$file" --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate
done
- name: Publish to NuGet.org (Preview)
if: secrets.NUGET_API_KEY != ''
run: |
for file in ${{ env.NUGET_DIRECTORY }}/*.nupkg
do
dotnet nuget push "$file" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
done