Skip to content

Commit

Permalink
gh workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
k-wojcik committed Mar 20, 2024
1 parent 9588b7a commit 0fa8d2a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 18 deletions.
17 changes: 2 additions & 15 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
36 changes: 36 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions src/DocFxToTemplate.Tool/DocFxToTemplate.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Docfx.App" Version="2.75.3" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
<PackageReference Include="Docfx.Dotnet" Version="2.75.3"/>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1"/>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0"/>
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.3"/>
</ItemGroup>
</Project>

0 comments on commit 0fa8d2a

Please sign in to comment.