-
Notifications
You must be signed in to change notification settings - Fork 10
86 lines (75 loc) · 2.66 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
name: publish to nuget
on:
push:
branches:
- master
- main
jobs:
publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: NuGet/setup-nuget@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: read common.props
id: commonProps
uses: juliangruber/read-file-action@v1
with:
path: ./common.props
- name: get version
id: getVersion
uses: AsasInnab/regex-action@v1
with:
regex_pattern: '(?<=>)[^<>]+(?=</Version>)'
regex_flags: 'gim'
search_string: '${{ steps.commonProps.outputs.content }}'
- name: dotnet restore
run: dotnet restore -s "https://api.nuget.org/v3/index.json"
- name: dotnet build
run: dotnet build -c Release
- name: dotnet test
run: dotnet test -c Release --no-restore --no-build
- name: dotnet pack
run: dotnet pack -c Release --no-build --property PackageOutputPath=${{ github.workspace }}/nugetPackages/
- name: remove unused packages
run: |
cd ${{ github.workspace }}/nugetPackages
shopt -s extglob
rm -f !(EasyAbp.*)
rm -f !(*.${{ steps.getVersion.outputs.first_match }}.nupkg)
rm -f *.Blazor.Host.*
rm -f *.Blazor.Server.Host.*
rm -f *.Host.Shared.*
rm -f *.HttpApi.Host.*
rm -f *.IdentityServer.*
rm -f *.AuthServer.*
rm -f *.Web.Host.*
rm -f *.Web.Unified.*
rm -f *.HttpApi.Client.ConsoleTestApp.*
rm -f *.Tests.*
rm -f *.TestBase.*
ls
- name: dotnet nuget push to GitHub
uses: tanaka-takayoshi/[email protected]
with:
nupkg-path: '${{ github.workspace }}/nugetPackages/*.nupkg'
repo-owner: 'EasyAbp'
gh-user: 'EasyAbp'
token: ${{ secrets.GITHUB_TOKEN }}
- name: dotnet nuget push to NuGet
run: dotnet nuget push ${{ github.workspace }}/nugetPackages/*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: determine if the tag exists
uses: mukunku/[email protected]
id: checkTag
with:
tag: ${{ steps.getVersion.outputs.first_match }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: add git tag
if: ${{ steps.checkTag.outputs.exists == 'false' }}
uses: tvdias/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.getVersion.outputs.first_match }}