ant-design-blazor/.github/workflows/nightly-build.yml
James Yeung 56c212c2b1
chore(i18n): publish the localization libraray to nuget (#3824)
* chore(i18n): publish the localization libraray to nuget

* fix build error
2024-04-26 00:26:25 +08:00

141 lines
4.7 KiB
YAML

name: Nightly Build
env:
NUGET_API_KEY: ${{secrets.NUGET_API_KEY}}
on:
push:
branches:
- master
- feature
jobs:
nightly-build:
runs-on: ubuntu-latest
if: github.repository_owner == 'ant-design-blazor'
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.300
- name: Setup .NET 5
uses: actions/setup-dotnet@v3
with:
dotnet-version: 5.0.100
- name: Setup .NET 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.101
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.100
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.100
- uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Check Building ⚙
run: |
npm install
dotnet build
- name: Test 📝
run: |
dotnet test ./tests/AntDesign.Tests/AntDesign.Tests.csproj --configuration:Release --collect:"XPlat Code Coverage"
npm install ./tests/AntDesign.Tests.Js
npm --prefix ./tests/AntDesign.Tests.Js run test-cov
find ./coverage ./tests -name "*coverage*.xml" -type f -exec cp {} ./ \;
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.cobertura.xml,./cobertura-coverage.xml
fail_ci_if_error: false
- name: "Get Last Release"
id: previoustag
run: |
LAST_VERSION=$(wget --no-check-certificate -qO- https://api.github.com/repos/ant-design-blazor/ant-design-blazor/tags | grep 'name' | cut -d\" -f4 | head -1)
echo "Last Version: ${LAST_VERSION}"
echo "::set-output name=previous_tag::${LAST_VERSION}"
- name: "Get Next Semantic Version"
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.previous_tag }}
- name: "Get Next Version"
id: get_next_version
run: |
current_branch=$(git symbolic-ref --short -q HEAD)
echo Current git branch is $current_branch
next_version=''
if [ "$current_branch" == 'master' ] ;
then
next_version=$patch_version
else
next_version=$minor_version
fi
echo Will release version $next_version for branch $current_branch
echo "::set-output name=next_version::${next_version}"
echo "::set-output name=current_branch::${current_branch}"
env:
patch_version: ${{ steps.semvers.outputs.patch }}
minor_version: ${{ steps.semvers.outputs.minor }}
- name: Package Nightly Nuget 📦
id: pack
run: |
FULL_VERSION=$next_version-nightly-`date "+%y%m%d%H%M"`
echo "Version: ${FULL_VERSION}"
echo "::set-output name=package_version::${FULL_VERSION}"
dotnet build
dotnet pack components/AntDesign.csproj /p:PackageVersion=${FULL_VERSION} -c Release -o publish
dotnet pack src/AntDesign.Extensions.Localization/AntDesign.Extensions.Localization.csproj /p:PackageVersion=${FULL_VERSION} -c Release -o publish
dotnet pack tests/AntDesign.TestKit/AntDesign.TestKit.csproj /p:PackageVersion=${FULL_VERSION} -c Release -o publish
env:
next_version: ${{ steps.get_next_version.outputs.next_version }}
- name: Upload package artifact
uses: actions/upload-artifact@v2
with:
name: package
path: publish/
retention-days: 5
- name: Push to MyGet package registry
run: dotnet nuget push './publish/*.nupkg' --source https://www.myget.org/F/ant-design-blazor/api/v3/index.json --api-key ${{ secrets.MYGET_API_KEY }} --skip-duplicate
- name: Publish Docs 🎉
run: |
npm install
sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net8 -o cargo
env:
PACKAGE_VERSION: ${{ steps.pack.outputs.package_version }}
- name: Deploy Preview 🚀
run: |
npm install -g surge
surge --project ./cargo/wwwroot --domain $BRANCH-antblazor.surge.sh
env:
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
BRANCH: ${{ steps.get_next_version.outputs.current_branch }}