Update workflow #38
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: Kryptor CI | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'src/**' | |
- 'test/**' | |
branches: [master, dev] | |
pull_request: | |
branches: [master] | |
permissions: | |
checks: | |
write | |
contents: | |
write | |
packages: | |
write | |
pull-requests: | |
write | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
dotnet: | |
strategy: | |
matrix: | |
os: [ubuntu] | |
configuration: [Nuget] | |
name: Build ${{ matrix.configuration }} Configuration on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }}-latest | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
cache: true | |
cache-dependency-path: '**/packages.lock.json' | |
dotnet-version: | | |
6.0.x | |
8.0.x | |
- name: Install dependencies | |
run: | | |
./build.sh -t restore-all | |
./build.sh -t restore-tests | |
- name: Build | |
run: | | |
./build.sh -t build-all -c ${{ matrix.configuration }} --no-restore true | |
./build.sh -t build-tests -c ${{ matrix.configuration }} --no-restore true | |
shell: bash | |
- name: Test | |
run: | | |
./build.sh -t test-all -c ${{ matrix.configuration }} --no-build true | |
shell: bash | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: matrix.os == 'ubuntu' && matrix.configuration == 'Nuget' | |
with: | |
files: | | |
**/TestResults/*.trx | |
- name: Codecov | |
uses: codecov/codecov-action@v4 | |
if: env.CODECOV_TOKEN != '' && matrix.os == 'ubuntu' && matrix.configuration == 'Nuget' | |
env: | |
CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }} | |
- name: Create NuGet package | |
if: github.event_name != 'pull_request' | |
run: | | |
./build.sh -t pack-all -c ${{ matrix.configuration }} --no-build true | |
shell: bash | |
- name: Deploy to Github packages | |
continue-on-error: true | |
run: | | |
for TARGET in artifacts/packages/${{ matrix.configuration }}/*.nupkg | |
do | |
echo Uploading $TARGET | |
dotnet nuget push $TARGET --api-key ${{ secrets.GITHUB_TOKEN }} --source github --skip-duplicate || continue | |
done | |
shell: bash | |
- name: Deploy to NuGet gallery | |
continue-on-error: true | |
run: | | |
for TARGET in artifacts/packages/${{ matrix.configuration }}/*.nupkg | |
do | |
echo Uploading $TARGET | |
dotnet nuget push $TARGET --api-key ${{ secrets.NUGET_API_KEY }} --source "nuget.org" --skip-duplicate || continue | |
done | |
shell: bash | |