From 8a88dfc3c3f5ebb6aa1210e29b1379912b0e2d93 Mon Sep 17 00:00:00 2001 From: Yufei Huang Date: Tue, 24 Oct 2023 10:46:49 +0800 Subject: [PATCH] add release script --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 23 +++++++++++++++++++++++ Directory.Build.props | 9 +++++++++ version.json | 6 ------ 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 version.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a603781..42f2d95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,6 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.x + dotnet-version: 6.x - name: Build and Test run: ./build.ps1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..327dd69 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: release +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 6.x + + - run: dotnet pack src/yunit -c Release /p:Version=${GITHUB_REF_NAME#v} -o drop/nuget + + - uses: actions/upload-artifact@v3 + with: + name: nuget + path: drop/nuget + + - run: dotnet nuget push drop/nuget/*.nupkg --api-key "${{ secrets.NUGET_KEY }}" --skip-duplicate --source https://api.nuget.org/v3/index.json diff --git a/Directory.Build.props b/Directory.Build.props index 4da0461..ed29407 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,5 +12,14 @@ Latest true + + true + true + snupkg + true + + + + \ No newline at end of file diff --git a/version.json b/version.json deleted file mode 100644 index bb4e978..0000000 --- a/version.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0-preview.{height}", - "publicReleaseRefSpec": [ - "^refs/tags/v\\d+\\.\\d+$" - ] -} \ No newline at end of file