chore: fix docs aot publish

This commit is contained in:
ElderJames 2021-09-16 15:41:55 +08:00
parent 3923896c68
commit a389a87cef
3 changed files with 80 additions and 142 deletions

View File

@ -1,95 +0,0 @@
name: Publish Docs with AOT
env:
NUGET_API_KEY: ${{secrets.NUGET_API_KEY}}
on:
push:
branches:
- master
- feature
jobs:
publish-and-deploy:
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@v1
with:
dotnet-version: 3.1.300
- name: Setup .NET Core 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
include-prerelease: true
- uses: actions/setup-node@v1
with:
node-version: "10.x"
- 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 "::set-output name=current_branch::${current_branch}"
FULL_VERSION=$next_version-nightly-`date "+%y%m%d%H%M"`
echo "Version: ${FULL_VERSION}"
echo "::set-output name=package_version::${FULL_VERSION}"
env:
patch_version: ${{ steps.semvers.outputs.patch }}
minor_version: ${{ steps.semvers.outputs.minor }}
- name: Prepare AOT workload
run: |
dotnet workload install wasm-tools
- name: Publish Docs 🎉
run: |
npm install
sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor
dotnet build
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o cargo -p:EnableAOT=true
env:
PACKAGE_VERSION: ${{ steps.pack.outputs.package_version }}
- name: Deploy Preview 🚀
run: |
npm install -g surge
surge --project ./cargo/wwwroot --domain $BRANCH-aot-antblazor.surge.sh
env:
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
BRANCH: ${{ steps.get_next_version.outputs.current_branch }}

80
.github/workflows/release-AOT.yml vendored Normal file
View File

@ -0,0 +1,80 @@
name: Publish Docs with AOT
on:
push:
tags:
- "*"
jobs:
publish-and-deploy:
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@v1
with:
dotnet-version: 3.1.300
- name: Setup .NET Core 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
include-prerelease: true
- uses: actions/setup-node@v1
with:
node-version: "10.x"
- name: Prepare AOT workload
run: |
dotnet workload install wasm-tools
- name: Publish Docs 🎉
id: publish
run: |
VERSION=`git describe --tags`
echo "::set-output name=package_version::${VERSION}"
npm install
echo "/* updated `date "+%Y-%m-%d %H:%M:%S"` */" >> ./site/AntDesign.Docs.Wasm/wwwroot/service-worker.published.js
cp -rf scripts/gh-pages/* scripts/gh-pages/.nojekyll scripts/gh-pages/.spa ./site/AntDesign.Docs.Wasm/wwwroot
sed -i s/{version}/$VERSION/g ./site/AntDesign.Docs.Wasm/wwwroot/index.html
sed -i s/{version}/$VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor
dotnet build
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o cargo -p:EnableAOT=true
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
BRANCH: gh-pages
FOLDER: cargo/wwwroot
- name: Deploy to Github.io 🚀
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GH_PUSH_TOKEN }}
external_repository: ant-design-blazor/ant-design-blazor.github.io
publish_branch: master
publish_dir: ./cargo/wwwroot
cname: antblazor.com
keep_files: true
tag_name: ${{ steps.publish.outputs.package_version }}
- 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"

View File

@ -26,16 +26,6 @@ jobs:
with:
dotnet-version: 5.0.100
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
include-prerelease: true
- name: Prepare AOT workload
run: |
dotnet workload install wasm-tools
- uses: actions/setup-node@v1
with:
node-version: "10.x"
@ -45,7 +35,6 @@ jobs:
run: |
VERSION=`git describe --tags`
echo "Publishing Version: ${VERSION}"
echo "::set-output name=package_version::${VERSION}"
npm install
dotnet build
dotnet pack components/AntDesign.csproj /p:PackageVersion=$VERSION -c Release -o publish
@ -58,39 +47,3 @@ jobs:
name: package
path: publish/
retention-days: 5
- name: Publish Docs 🎉
run: |
echo "/* updated `date "+%Y-%m-%d %H:%M:%S"` */" >> ./site/AntDesign.Docs.Wasm/wwwroot/service-worker.published.js
cp -rf scripts/gh-pages/* scripts/gh-pages/.nojekyll scripts/gh-pages/.spa ./site/AntDesign.Docs.Wasm/wwwroot
sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs.Wasm/wwwroot/index.html
sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net6 -o cargo -p:EnableAOT=true
env:
PACKAGE_VERSION: ${{ steps.pack.outputs.package_version }}
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
BRANCH: gh-pages
FOLDER: cargo/wwwroot
- name: Deploy to Github.io 🚀
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GH_PUSH_TOKEN }}
external_repository: ant-design-blazor/ant-design-blazor.github.io
publish_branch: master
publish_dir: ./cargo/wwwroot
cname: antblazor.com
keep_files: true
tag_name: ${{ steps.pack.outputs.package_version }}
- 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"