mirror of https://github.com/EasyAbp/EShop.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.7 KiB
86 lines
2.7 KiB
name: publish to nuget
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: NuGet/setup-nuget@v2
|
|
- uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: '10.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/nuget-publish-to-github-packages-action@v2.1
|
|
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/tag-exists-action@v1.0.0
|
|
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/github-tagger@v0.0.1
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
tag: ${{ steps.getVersion.outputs.first_match }}
|
|
|