-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (46 loc) · 2.07 KB
/
dotnet.yml
File metadata and controls
49 lines (46 loc) · 2.07 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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: dotnet
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 10.x
- name: Version (release)
run: |
OLD=$(yq ".Project.PropertyGroup[0].Version" -p xml -o xml src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj)
NEW="$OLD.${COUNTER}" yq ".Project.PropertyGroup[0].Version = env(NEW)" -p xml -o xml -i src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj
cat src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj
env:
COUNTER: ${{ github.run_number }}
if: github.ref == 'refs/heads/main'
- name: Version (pre-release)
run: |
OLD=$(yq ".Project.PropertyGroup[0].Version" -p xml -o xml src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj)
NEW="$OLD.${COUNTER}-alpha" yq ".Project.PropertyGroup[0].Version = env(NEW)" -p xml -o xml -i src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj
cat src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj
env:
COUNTER: ${{ github.run_number }}
if: github.ref != 'refs/heads/main'
- name: Restore dependencies
run: dotnet restore src/Pingmint.CodeGen.Sql
- name: Build
run: dotnet build --configuration Release --no-restore src/Pingmint.CodeGen.Sql
- name: Test
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal src/Pingmint.CodeGen.Sql
- name: Pack
run: dotnet pack --configuration Release --no-build --no-restore --verbosity normal --output ./nupkg src/Pingmint.CodeGen.Sql
- name: Push
run: dotnet nuget push ./nupkg/*.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key $NUGET_API_KEY
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
#if: github.ref == 'refs/heads/main'