-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (74 loc) · 2.63 KB
/
publish.yml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# This is a basic workflow to help you get started with Actions
name: Publish Static Serializer
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
VSTEST_CONNECTION_TIMEOUT: 180
DOTNET_NOLOGO: "true"
steps:
- uses: actions/checkout@v4
- name: Checkout aaubry/yamldotnet
id: yamldotnet
uses: actions/checkout@v4
with:
repository: aaubry/yamldotnet
ref: master
fetch-depth: 0
path: yamldotnet
submodules: 'true'
- name: Get current version
id: version
working-directory: yamldotnet
run: |
VERSION=$(git tag -l --sort=-v:refname v* | head -n 1 | sed -e 's/^v//')
echo "Using $VERSION"
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Install dotnet 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x
- name: Install dotnet 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Install dotnet 7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Build
id: build
working-directory: yamldotnet
run: dotnet build -c Release YamlDotNet.sln
# - name: Test
# id: test
# working-directory: yamldotnet
# run: dotnet test -c Release --no-build YamlDotNet.sln
- name: Pack
id: pack
working-directory: yamldotnet/YamlDotNet.Analyzers.StaticGenerator
run: |
echo "Setting NuspecProperties in csproj file"
sed -i '/<PropertyGroup>/a <NuspecProperties>PackageVersion=$(PackageVersion)<\/NuspecProperties>' YamlDotNet.Analyzers.StaticGenerator.csproj
echo "Copying nuspec"
cp $GITHUB_WORKSPACE/YamlDotNet.Analyzers.StaticGenerator.nuspec .
echo "Packing"
dotnet pack YamlDotNet.Analyzers.StaticGenerator.csproj \
-o $GITHUB_WORKSPACE/packed \
-p:NuspecFile=./YamlDotNet.Analyzers.StaticGenerator.nuspec \
-p:PackageVersion=$PACKAGE_VERSION
- name: Push
id: push
working-directory: packed
run: dotnet nuget push "*.nupkg" --skip-duplicate --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
# - name: Create a Release
# uses: elgohr/Github-Release-Action@v4
# env:
# GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
# with:
# title: ${{ env.PACKAGE_VERSION }}