2020-03-13 00:04:29 +08:00
|
|
|
name: Publish Docs
|
2019-12-04 21:43:44 +08:00
|
|
|
|
2019-12-12 22:51:33 +08:00
|
|
|
env:
|
2020-05-29 00:33:49 +08:00
|
|
|
NUGET_API_KEY: ${{secrets.NUGET_API_KEY}}
|
2019-12-12 22:51:33 +08:00
|
|
|
|
2020-03-05 12:17:50 +08:00
|
|
|
on:
|
2020-05-29 00:33:49 +08:00
|
|
|
push:
|
|
|
|
branches:
|
2020-05-29 09:40:48 +08:00
|
|
|
- master
|
2021-03-01 16:34:46 +08:00
|
|
|
- feature
|
2019-12-04 21:43:44 +08:00
|
|
|
|
|
|
|
jobs:
|
2020-05-29 00:33:49 +08:00
|
|
|
publish-and-deploy:
|
|
|
|
runs-on: ubuntu-latest
|
2020-05-29 09:40:48 +08:00
|
|
|
if: github.repository_owner == 'ant-design-blazor'
|
2020-03-05 12:17:50 +08:00
|
|
|
|
2020-05-29 00:33:49 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout 🛎️
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2020-03-05 12:17:50 +08:00
|
|
|
|
2020-11-15 13:19:30 +08:00
|
|
|
- name: Setup .NET Core 3.1
|
|
|
|
uses: actions/setup-dotnet@v1
|
|
|
|
with:
|
|
|
|
dotnet-version: 3.1.300
|
|
|
|
|
|
|
|
- name: Setup .NET Core 5.0
|
2020-05-29 00:33:49 +08:00
|
|
|
uses: actions/setup-dotnet@v1
|
|
|
|
with:
|
2020-11-14 23:44:48 +08:00
|
|
|
dotnet-version: 5.0.100
|
2020-03-05 12:17:50 +08:00
|
|
|
|
2020-05-29 00:33:49 +08:00
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: "10.x"
|
2020-03-07 17:00:14 +08:00
|
|
|
|
2020-08-05 22:36:52 +08:00
|
|
|
- name: Test And Coverage Report 📝
|
|
|
|
run: |
|
|
|
|
dotnet build
|
|
|
|
dotnet test --collect:"XPlat Code Coverage"
|
|
|
|
find ./tests -name "coverage.cobertura.xml" -type f -exec cp {} ./ \;
|
|
|
|
bash <(curl -s https://codecov.io/bash) -Z -f coverage.cobertura.xml -t $CODECOV_TOKEN
|
|
|
|
env:
|
|
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
|
2021-03-01 16:34:46 +08:00
|
|
|
- name: 'Get Last Release'
|
|
|
|
id: previoustag
|
|
|
|
run: |
|
2021-03-15 14:33:43 +08:00
|
|
|
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)
|
2021-03-01 16:34:46 +08:00
|
|
|
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 }}
|
|
|
|
|
2021-01-27 18:11:01 +08:00
|
|
|
- name: Package Nightly Nuget 📦
|
|
|
|
id: pack
|
|
|
|
run: |
|
2021-03-01 16:34:46 +08:00
|
|
|
FULL_VERSION=$next_version-nightly-`date "+%y%m%d%H%M"`
|
2021-01-27 18:11:01 +08:00
|
|
|
echo "Version: ${FULL_VERSION}"
|
|
|
|
echo "::set-output name=package_version::${FULL_VERSION}"
|
|
|
|
dotnet pack components/AntDesign.csproj /p:PackageVersion=${FULL_VERSION} -c Release -o publish
|
2021-03-01 16:34:46 +08:00
|
|
|
env:
|
|
|
|
next_version: ${{ steps.get_next_version.outputs.next_version }}
|
2021-01-27 18:11:01 +08:00
|
|
|
|
2021-03-15 14:33:43 +08:00
|
|
|
- name: Push to MyGet package registry
|
2021-03-03 14:08:49 +08:00
|
|
|
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
|
2021-03-01 16:34:46 +08:00
|
|
|
|
|
|
|
- name: Sync to Gitee 💕
|
|
|
|
uses: wearerequired/git-mirror-action@master
|
|
|
|
env:
|
|
|
|
SSH_PRIVATE_KEY: ${{ secrets.GITEE_PRIVATE_KEY }}
|
|
|
|
with:
|
|
|
|
source-repo: "git@github.com:ant-design-blazor/ant-design-blazor.git"
|
|
|
|
destination-repo: "git@gitee.com:ant-design-blazor/ant-design-blazor.git"
|
2021-01-27 18:11:01 +08:00
|
|
|
|
2020-05-29 00:33:49 +08:00
|
|
|
- name: Publish Docs 🎉
|
|
|
|
run: |
|
|
|
|
npm install
|
2021-02-06 19:27:48 +08:00
|
|
|
sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor
|
2020-11-14 23:44:48 +08:00
|
|
|
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net5 -o cargo
|
2021-01-27 18:11:01 +08:00
|
|
|
env:
|
2021-03-03 14:08:49 +08:00
|
|
|
PACKAGE_VERSION: ${{ steps.pack.outputs.package_version }}
|
2020-03-25 18:26:26 +08:00
|
|
|
|
2021-03-01 16:34:46 +08:00
|
|
|
- name: Deploy Preview 🚀
|
|
|
|
run: |
|
|
|
|
npm install -g surge
|
|
|
|
surge --project ./cargo/wwwroot --domain $BRANCH-antblazor.surge.sh
|
2020-05-29 00:33:49 +08:00
|
|
|
env:
|
2021-03-01 16:34:46 +08:00
|
|
|
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
|
|
|
|
BRANCH: ${{ steps.get_next_version.outputs.current_branch }}
|
2021-03-01 22:50:22 +08:00
|
|
|
|