diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ffe4289..b4cbe48 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,26 +15,5 @@ jobs: run: dotnet restore - name: build run: dotnet build --no-restore - release: - runs-on: ubuntu-latest - needs: build - #if: startsWith(github.ref, 'refs/tags/v') - steps: - - uses: actions/checkout@v3 - - name: Set VERSION variable from tag - run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV - - name: Setup .NET 8 SDK - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 8.0.x - - name: pack - run: | - dotnet pack ./src/DocFxToTemplate/DocFxToTemplate.csproj --configuration Release -o ./dist/nupkg -p:Version=${VERSION} - dotnet pack ./src/DocFxToTemplate.Tool/DocFxToTemplate.Tool.csproj --configuration Release -o ./dist/nupkg -p:Version=${VERSION} - #- name: push - #run: dotnet nuget push ./dist/nupkg/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json - - name: Archive NuGet packages - uses: actions/upload-artifact@v4 - with: - name: nuget-packages - path: ./dist/nupkg \ No newline at end of file + - name: test + run: dotnet test --no-restore \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..27874ea --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,36 @@ +name: release + +on: + release: + types: [published, edited] + +jobs: + release: + runs-on: ubuntu-latest + needs: build + if: startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/checkout@v3 + - name: Set VERSION variable from tag + run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV + - name: Setup .NET 8 SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + - name: restore + run: dotnet restore + - name: build + run: dotnet build --no-restore + - name: test + run: dotnet test --no-restore + - name: pack + run: | + dotnet pack ./src/DocFxToTemplate/DocFxToTemplate.csproj --configuration Release -o ./dist/nupkg -p:Version=${VERSION} + dotnet pack ./src/DocFxToTemplate.Tool/DocFxToTemplate.Tool.csproj --configuration Release -o ./dist/nupkg -p:Version=${VERSION} + - name: push + run: dotnet nuget push ./dist/nupkg/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json + - name: archive NuGet packages + uses: actions/upload-artifact@v4 + with: + name: nuget-packages + path: ./dist/nupkg \ No newline at end of file