Skip to content

Commit

Permalink
automate publish to Nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
simontreanor committed Nov 19, 2024
1 parent a796a51 commit b7135dc
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -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/<Version>[0-9]\+\.[0-9]\+\.[0-9]\+<\/Version>/<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

0 comments on commit b7135dc

Please sign in to comment.