Skip to content

Commit

Permalink
added actions to publish nuget package for ABAC and PEP (#833)
Browse files Browse the repository at this point in the history
* added actions to publish nuget package for ABAC and PEP

* added addition trigger on pull request for testing

* comment release tag check for testing

* Fixed PR comments

* updated build number to check if that causes the error

* Fix PR comments 2

* update nuget api key name

* update publish script and project properties for nuget

* Update the publish action

* updated publish action and package version for abac

* update package verison for testing

* update triggers

* updated the triggers and pep action

* updated dotnet version for pep

* replaced the apikey variable usage

* Update the package version for abac and dotnet version in publish script

* update the dotnet version in publish script

* updated dotnet version to 8 in abac action

* update dotnet version to 8 for pep action

* updated nuget action for PEP

* Updated pep project file

* Fixed the pep project file

---------

Co-authored-by: acn-dgopa <acn-dgopa@dev-acn-tje-14>
  • Loading branch information
acn-dgopa and acn-dgopa authored Apr 23, 2024
1 parent 14c6187 commit eec20b9
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 12 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/publish-abac-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Pack and publish Altinn.Authorization.ABAC nuget package

on:
release:
types:
- published

jobs:
build-pack:
if: startsWith(github.ref, 'refs/tags/Altinn.Authorization.ABAC-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Build
working-directory: src/Altinn.Authorization.ABAC
run: |
dotnet build --configuration Release
- name: Pack Altinn.Authorization.ABAC
working-directory: src/Altinn.Authorization.ABAC
run: |
dotnet pack --configuration Release --no-build
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: nuget package
path: src/Altinn.Authorization.ABAC/bin/Release/*.nupkg
if-no-files-found: error

- name: publish Altinn.Authorization.ABAC
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
working-directory: src/Altinn.Authorization.ABAC
run: |
dotnet nuget push bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY"
45 changes: 45 additions & 0 deletions .github/workflows/publish-pep-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Pack and publish Altinn.Common.PEP nuget package

on:
release:
types:
- published

jobs:
build-pack:
if: startsWith(github.ref, 'refs/tags/Altinn.Common.PEP-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Build
working-directory: src/Altinn.Common.PEP/Altinn.Common.PEP
run: |
dotnet build --configuration Release
- name: Pack Altinn.Common.PEP
working-directory: src/Altinn.Common.PEP/Altinn.Common.PEP
run: |
dotnet pack --configuration Release --no-build
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: nuget package
path: src/Altinn.Common.PEP/Altinn.Common.PEP/bin/Release/*.nupkg
if-no-files-found: error

- name: publish Altinn.Common.PEP
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
working-directory: src/Altinn.Common.PEP/Altinn.Common.PEP
run: |
dotnet nuget push bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY"
15 changes: 7 additions & 8 deletions src/Altinn.Authorization.ABAC/Altinn.Authorization.ABAC.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyVersion>0.0.0.8</AssemblyVersion>
<FileVersion>0.0.0.8</FileVersion>
<!-- SonarCloud requires a ProjectGuid to separate projects. -->
<ProjectGuid>{C9ABF5DB-928C-4280-B587-13E6DCE010BC}</ProjectGuid>

<!-- NuGet package properties -->
<PackageId>Altinn.Authorization.ABAC</PackageId>
<PackageVersion>0.0.8</PackageVersion>
<Version>0.0.8</Version>
<PackageTags>Altinn;Authorization;ABAC</PackageTags>
<Description>
Attribute Based Access Control library for .Net Core implementing XACML 3.0 xml and JSON Profile.
Expand All @@ -19,12 +17,13 @@
<PackageReleaseNotes>
</PackageReleaseNotes>
<Authors>Altinn Platform Contributors</Authors>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Altinn/altinn-studio</RepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all"/>
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.1.1" PrivateAssets="all"/>
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Debug'">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
<PackageReleaseNotes>
</PackageReleaseNotes>
<Authors>Altinn Platform Contributors</Authors>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/altinn/altinn-authorization</RepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all"/>
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.1.1" PrivateAssets="all"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Altinn.Authorization.ABAC" Version="0.0.8" />
<!-- More about this dependency in issue #5706 -->
Expand Down

0 comments on commit eec20b9

Please sign in to comment.