-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (51 loc) · 1.65 KB
/
_.yaml
File metadata and controls
58 lines (51 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: CI/CD
env: { DOTNET_NOLOGO: true }
on:
workflow_call:
inputs:
test: { type: boolean, default: false, description: Run tests. }
publish: { type: boolean, default: false, description: Publish to nuget. Will run all tests too. }
secrets:
nuget-user:
jobs:
pipeline:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read .NET Version
shell: pwsh
id: dotnet-version
run: |
$version = (Get-Content .\global.json -Raw | ConvertFrom-Json).sdk.version.TrimEnd('0') + 'x'
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Setup .NET
uses: actions/setup-dotnet@v4
with: { dotnet-version: "${{ steps.dotnet-version.outputs.version }}" }
- name: Build
working-directory: src
shell: pwsh
run: dotnet build NoSQLite -c Release
- name: Test
if: inputs.test || inputs.publish
working-directory: test
run: dotnet test --project NoSQLite.Test -c Release
- name: Pack
if: inputs.publish
working-directory: src
run: dotnet pack NoSQLite --no-restore --no-build
- name: Login
if: inputs.publish
id: login
uses: NuGet/login@v1
with:
user: ${{ secrets.nuget-user }}
- name: Push
if: inputs.publish
working-directory: artifacts/src/package/release
env:
SOURCE_URL: https://api.nuget.org/v3/index.json
NUGET_AUTH_TOKEN: ${{ steps.login.outputs.NUGET_API_KEY }}
run: dotnet nuget push *.nupkg --skip-duplicate -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }}