From ea4788f89457f34dc24ce98e9e7492dad026401a Mon Sep 17 00:00:00 2001 From: cxfksword <718792+cxfksword@users.noreply.github.com> Date: Fri, 24 Nov 2023 23:21:33 +0800 Subject: [PATCH] build: update build script --- .github/workflows/beta.yaml | 6 +++++- .github/workflows/build.yaml | 4 +--- .github/workflows/publish.yaml | 6 +++++- global.json | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 global.json diff --git a/.github/workflows/beta.yaml b/.github/workflows/beta.yaml index 037dcbd..e40207d 100644 --- a/.github/workflows/beta.yaml +++ b/.github/workflows/beta.yaml @@ -11,7 +11,7 @@ env: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest name: Build & Release steps: @@ -20,8 +20,12 @@ jobs: run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - name: Setup dotnet uses: actions/setup-dotnet@v3 + id: dotnet with: dotnet-version: ${{ env.dotnet-version }} + - name: Change default dotnet version + run: | + echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json - name: Initialize workflow variables id: vars run: | diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 51c29ab..889a178 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,11 +15,9 @@ jobs: id: dotnet with: dotnet-version: 6.0.x - - name: force dotnet version + - name: Change default dotnet version run: | echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json - - name: print - run: dotnet --list-sdks && dotnet --info - name: Install dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index d00a616..948ee9f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -12,7 +12,7 @@ env: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest name: Build & Release steps: @@ -21,8 +21,12 @@ jobs: run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - name: Setup dotnet uses: actions/setup-dotnet@v3 + id: dotnet with: dotnet-version: ${{ env.dotnet-version }} + - name: Change default dotnet version + run: | + echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json - name: Setup python uses: actions/setup-python@v2 with: diff --git a/global.json b/global.json new file mode 100644 index 0000000..ec9400d --- /dev/null +++ b/global.json @@ -0,0 +1 @@ +{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}