From 4aafd894ffcaae175d758f5bb2ac590d05401f85 Mon Sep 17 00:00:00 2001 From: James Yeung Date: Mon, 3 Jul 2023 12:57:44 +0800 Subject: [PATCH] Chore: add setup .NET 7 SDK and release script for github actions (#17) --- .github/workflows/gh-pages.yml | 11 +++-------- .github/workflows/pr-checks.yml | 26 ++++++++++++++++++++++++ .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/pr-checks.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 0633658..dbf32ba 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -20,15 +20,10 @@ jobs: with: persist-credentials: false - - name: Setup .NET Core 3.1 + - name: Setup .NET Core 7.0 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 + dotnet-version: 7.0.100 - name: Publish Docs 🎉 run: | @@ -36,7 +31,7 @@ jobs: cp -rf gh-pages/* gh-pages/.nojekyll gh-pages/.spa ./ cd ../../../ dotnet build - dotnet publish -c Release -f net5 -o cargo + dotnet publish -c Release -f net7 -o cargo - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@releases/v3 diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..9cd2bd0 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,26 @@ +name: Pull Request Checks + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.100 + + - uses: actions/setup-node@v1 + with: + node-version: '10.x' + + - name: Check Building ⚙ + run: | + npm i + dotnet build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b26dd5b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release + +env: + NUGET_API_KEY: ${{secrets.NUGET_API_KEY}} + +on: + push: + tags: + - '*' + +jobs: + release-and-publish-package: + runs-on: ubuntu-latest + if: github.repository_owner == 'ant-design-blazor' + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: 7.0.100 + + - uses: actions/setup-node@v1 + with: + node-version: '10.x' + + - name: Package and publish to Nuget📦 + run: | + VERSION=`git describe --tags` + echo "Publishing Version: ${VERSION}" + npm install + dotnet build + rm -rf ./node_modules + dotnet pack src/UEditor/UEditor.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