diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 35330d2..20a77c4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,18 +15,5 @@ jobs: run: dotnet restore - name: build run: dotnet build --no-restore - # release to NuGet if push of tag - release: - runs-on: ubuntu-latest - needs: build - if: startsWith(github.ref, 'refs/tags/') - steps: - - uses: actions/checkout@v3 - - name: Setup .NET 8 SDK - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 8.0.x - - name: pack - run: dotnet pack --configuration Release -o ./bin/nupkg - - name: push - run: dotnet nuget push ./bin/nupkg/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json + - 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..62d9399 --- /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 diff --git a/src/DocFxToTemplate.Tool/DocFxToTemplate.Tool.csproj b/src/DocFxToTemplate.Tool/DocFxToTemplate.Tool.csproj index e6b1cb0..c4797f7 100644 --- a/src/DocFxToTemplate.Tool/DocFxToTemplate.Tool.csproj +++ b/src/DocFxToTemplate.Tool/DocFxToTemplate.Tool.csproj @@ -18,9 +18,9 @@ - - + + - +