From b7135dcb507728b2c356b029f59266619f91db38 Mon Sep 17 00:00:00 2001 From: Simon Treanor Date: Tue, 19 Nov 2024 21:55:44 +0000 Subject: [PATCH] automate publish to Nuget --- .github/workflows/docs.yml | 9 +++++++- .github/workflows/nuget.yml | 41 +++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nuget.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index af15584..aec87de 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,16 +8,23 @@ on: jobs: build: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 + - name: Setup .NET uses: actions/setup-dotnet@v4 + - name: Restore tools run: dotnet tool restore + - name: Build code run: dotnet build -c Release + - name: Generate the documentation run: dotnet fsdocs build --properties Configuration=Release --eval + - name: Upload documentation uses: actions/upload-pages-artifact@v3 with: diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 0000000..843a22e --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,41 @@ +name: Publish NuGet + +on: + workflow_dispatch: + inputs: + version: + description: 'Version number' + required: true + +jobs: + build: + runs-on: ubuntu-latest + env: + PROJECT_FILE: src/FSharp.Finance.Personal.fsproj + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + + - name: Update version number + run: | + VERSION=${{ github.event.inputs.version }} + echo "Updating version to $VERSION" + sed -i "s/[0-9]\+\.[0-9]\+\.[0-9]\+<\/Version>/$VERSION<\/Version>/" ${{ env.PROJECT_FILE }} + + - name: Build + run: dotnet build -c Release + + - name: Pack + run: dotnet pack -c Release --no-build --output . + + # - name: Publish NuGet package + # run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json + + - name: Create Git tag + run: | + git tag $VERSION + git push origin $VERSION