Skip to content

Commit

Permalink
feat: add Nuget package publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ahanoff committed Sep 13, 2024
1 parent c025bc1 commit d05ca3e
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish NuGet Package

on:
release:
types: [published]

jobs:
github:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Pack
run: dotnet pack --configuration Release --no-build --output nupkgs

- name: Push to GitHub Packages
run: |
for f in ./nupkgs/*.nupkg
do
dotnet nuget push $f --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ secrets.GITHUB_TOKEN }}
done
nuget-org:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Pack
run: dotnet pack --configuration Release --no-build --output nupkgs

- name: Push to NuGet.org
run: dotnet nuget push ./nupkgs/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} --skip-duplicate
14 changes: 14 additions & 0 deletions src/AEMO.MDFF/AEMO.MDFF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.1.0-alpha1</Version>
<Title>AEMO.MDFF</Title>
<Authors>Akhan Zhakiyanov</Authors>
<Description>Parser for Australian Energy Market Operator (AEMO) Meter Data File Format (MDFF) specification</Description>
<Copyright>Copyright © 2024, Akhan Zhakiyanov. All rights reserved.</Copyright>
<PackageProjectUrl>https://github.com/ahanoff/aemo-mdff-net</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<RepositoryUrl>https://github.com/ahanoff/aemo-mdff-net</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>parsing;aemo;nem12;nem13;meter-reading</PackageTags>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Company>ahanoff</Company>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit d05ca3e

Please sign in to comment.