chore: adjusting the release cycle and versioning

This commit is contained in:
ElderJames 2021-03-01 16:34:46 +08:00
parent a49da1ffed
commit 5aa3f7dcd0
2 changed files with 96 additions and 34 deletions

View File

@ -1,13 +1,13 @@
name: Publish Docs
env:
Version: 0.7.0
NUGET_API_KEY: ${{secrets.NUGET_API_KEY}}
on:
push:
branches:
- master
- feature
jobs:
publish-and-deploy:
@ -43,17 +43,63 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: 'Get Last Release'
id: previoustag
run: |
git fetch --tags
# This suppress an error occurred when the repository is a complete one.
git fetch --prune --unshallow || true
LAST_VERSION=$(git describe --abbrev=0 --tags)
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=$Version-nightly-`date "+%y%m%d%H%M"`
FULL_VERSION=$next_version-nightly-`date "+%y%m%d%H%M"`
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
env:
next_version: ${{ steps.get_next_version.outputs.next_version }}
- name: Publish to Nuget ✔
run: |
dotnet nuget push publish/*.nupkg -s https://api.nuget.org/v3/index.json -k $NUGET_API_KEY --skip-duplicate
- name: Push to GitHub package registry
run: dotnet nuget push ./publish/*.nupkg --source ${{ env.REPOSITORY_URL }} --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols true
env:
REPOSITORY_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
- 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"
- name: Publish Docs 🎉
run: |
@ -64,33 +110,12 @@ jobs:
sed -i s/{version}/$PACKAGE_VERSION/g ./site/AntDesign.Docs/Shared/HeaderMenu.razor
dotnet publish ./site/AntDesign.Docs.Wasm -c Release -f net5 -o cargo
env:
PACKAGE_VERSION: ${{ steps.pack.outputs.package_version }}
PACKAGE_VERSION: ${{ steps.get_next_version.outputs.next_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
tag_name: ${{ steps.pack.outputs.package_version }}
- name: Sync to Gitee 💕
uses: wearerequired/git-mirror-action@master
- name: Deploy Preview 🚀
run: |
npm install -g surge
surge --project ./cargo/wwwroot --domain $BRANCH-antblazor.surge.sh
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"
# - name: 🧹Purge jsDeliver CDN
# run: |
# bash ./scripts/purge-jsdelivr.sh ./cargo/wwwroot ant-design-blazor/ant-design-blazor.github.io
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
BRANCH: ${{ steps.get_next_version.outputs.current_branch }}

View File

@ -34,7 +34,44 @@ jobs:
run: |
VERSION=`git describe --tags`
echo "Publishing Version: ${VERSION}"
echo "::set-output name=package_version::${VERSION}"
npm install
dotnet build components/AntDesign.csproj
dotnet pack components/AntDesign.csproj /p:PackageVersion=$VERSION -c Release -o publish
dotnet nuget push publish/*.nupkg -s https://api.nuget.org/v3/index.json -k $NUGET_API_KEY --skip-duplicate
dotnet nuget push publish/*.nupkg -s https://api.nuget.org/v3/index.json -k $NUGET_API_KEY --skip-duplicate
- name: Publish Docs 🎉
run: |
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}/$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 net5 -o cargo
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
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"