-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (96 loc) · 3.29 KB
/
thankifi.common.filters.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
92
93
94
95
96
97
name: Build & Publish - Thankifi.Common.Filters
on:
push:
pull_request:
release:
types:
- published
env:
# Stop wasting time caching packages / Disable sending usage data to Microsoft
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: Thankifi.Common.Filters
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/thankifi/
GITHUB_USER: thankifibot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOCAL_NUGET_DIRECTORY: ${{ github.workspace}}/nuget
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
source-url: ${{ env.GITHUB_FEED }}/index.json
- name: Restore
working-directory: ./src
run: dotnet restore
- name: Run tests
working-directory: ./src
run: dotnet test --configuration Release
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
source-url: ${{ env.GITHUB_FEED }}/index.json
- name: Restore
working-directory: ./src
run: dotnet restore
- name: Pack
if: github.event_name != 'release'
working-directory: ./src
run: dotnet pack --configuration Release --no-restore --include-symbols --include-source --output ${{ env.LOCAL_NUGET_DIRECTORY }} $PROJECT_NAME/$PROJECT_NAME.csproj
- name: Pack for Release
if: github.event_name == 'release'
working-directory: ./src
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
VERSION="${VERSION//v}"
dotnet pack --configuration Release --no-restore --include-symbols --include-source -p:PackageVersion=$VERSION --output ${{ env.LOCAL_NUGET_DIRECTORY }} $PROJECT_NAME/$PROJECT_NAME.csproj
- uses: actions/upload-artifact@v3
with:
name: nupkg
if-no-files-found: error
retention-days: 7
path: ${{ env.LOCAL_NUGET_DIRECTORY }}/*.nupkg
deploy:
needs: [ build, test ]
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
source-url: ${{ env.GITHUB_FEED }}/index.json
- name: Retrieve artifact
uses: actions/[email protected]
with:
name: nupkg
path: ${{ env.LOCAL_NUGET_DIRECTORY }}
# - name: Create Release NuGet package
# run: |
# arrTag=(${GITHUB_REF//\// })
# VERSION="${arrTag[2]}"
# echo Version: $VERSION
# VERSION="${VERSION//v}"
# echo Clean Version: $VERSION
# dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
- name: Push to GitHub Feed
working-directory: ${{ env.LOCAL_NUGET_DIRECTORY }}
run: |
for f in ./*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done