Skip to content

Commit

Permalink
automate publish to Nuget
Browse files Browse the repository at this point in the history
(cherry picked from commit 536c93d)
  • Loading branch information
simontreanor committed Nov 19, 2024
1 parent fe18a36 commit 6d3b5ac
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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 Core
uses: actions/setup-dotnet@v1

- name: Get current version
id: get_version
run: |
CURRENT_VERSION=$(grep -oP '(?<=<Version>)[^<]+' ${{ env.PROJECT_FILE }})
echo "Current version is $CURRENT_VERSION"
echo "::set-output name=current_version::$CURRENT_VERSION"
- 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 config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git tag $VERSION
git push origin $VERSION

0 comments on commit 6d3b5ac

Please sign in to comment.