-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.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
name: Publish
on:
push:
tags:
- 'v*' # Publish on any new tag starting with v
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Set RELEASE_VERSION env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Create nuget package
run: dotnet pack src/TDigestNet/TDigestNet.csproj -c Release /p:Version=${{ env.RELEASE_VERSION }}
- name: prepare artifacts
run: |
ARTIFACT_NUPKG_PATHNAME=$(ls src/TDigestNet/bin/Release/*.nupkg | head -n 1)
echo "ARTIFACT_NUPKG_PATHNAME=${ARTIFACT_NUPKG_PATHNAME}" >> $GITHUB_ENV
cd src/TDigestNet/bin/Release/
ls */*.dll | xargs -I _FILE_ bash -c "cp _FILE_ \$(echo _FILE_ | sed 's/\//_/g')"
ls */*.pdb | xargs -I _FILE_ bash -c "cp _FILE_ \$(echo _FILE_ | sed 's/\//_/g')"
ls */*.xml | xargs -I _FILE_ bash -c "cp _FILE_ \$(echo _FILE_ | sed 's/\//_/g')"
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
src/TDigestNet/bin/Release/*.nupkg
src/TDigestNet/bin/Release/*.dll
src/TDigestNet/bin/Release/*.pdb
src/TDigestNet/bin/Release/*.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: nuget push
run: dotnet nuget push "${NUPKG_PATH}" --api-key "${NUGET_KEY}" --source https://api.nuget.org/v3/index.json
env:
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
NUPKG_PATH: ${{ env.ARTIFACT_NUPKG_PATHNAME }}