Skip to content

Commit

Permalink
Release v0.1.4 (#8)
Browse files Browse the repository at this point in the history
This release decouples NuGet package publishing and Github Releases for
now.

Signed-off-by: Philip Conrad <[email protected]>
  • Loading branch information
philipaconrad authored Sep 24, 2024
1 parent 77117b5 commit f31e4cf
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 104 deletions.
100 changes: 0 additions & 100 deletions .github/workflows/03_publish.yaml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/03a_publish_nuget_pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: "3a – Publish Package to NuGet"

# Trigger the action on push to main
on:
push:
branches:
- "main"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace }}/nuget

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Get all history for automatic versioning

- name: Setup .NET
uses: actions/setup-dotnet@v4

- name: Restore dependencies
run: dotnet restore

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

- name: Test
run: dotnet test --no-restore --verbosity normal

- name: Get latest version from NuGet
id: nuget_version
run: |
$latestVersion = (Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/styra.opa.aspnetcore/index.json" | ConvertFrom-Json).versions[-1]
echo "LATEST_VERSION=$latestVersion" >> $env:GITHUB_OUTPUT
shell: pwsh

- name: Get current version
id: current_version
run: |
$currentVersion = (Select-Xml -Path src/Styra.Opa.AspNetCore/Styra.Opa.AspNetCore.csproj -XPath "//PackageVersion").Node.InnerText
echo "CURRENT_VERSION=$currentVersion" >> $env:GITHUB_OUTPUT
shell: pwsh

- name: Pack
run: dotnet pack --configuration Release --output ${{ env.NuGetDirectory }} --no-build

- name: Publish NuGet package
if: steps.nuget_version.outputs.LATEST_VERSION != steps.current_version.outputs.CURRENT_VERSION
run: |
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Filter *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}
shell: pwsh
36 changes: 36 additions & 0 deletions .github/workflows/03b_publish_gh_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "3 – Publish Github Release"

# Trigger the action on push to main
on:
push:
tags:
- "v*" # Trigger on tags starting with 'v'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace }}/nuget

jobs:
github-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Get all history for automatic versioning

- name: Generate Styra.Opa.AspNetCore GH release notes
run: scripts/latest-release-notes.sh --output=SDK_RELEASE_NOTES.md
env:
VERSION: ${{ steps.current_version.outputs.CURRENT_VERSION }}

- name: Create Styra.Opa.AspNetCore GH release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body_path: SDK_RELEASE_NOTES.md
tag_name: ${{ github.ref }}
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
All notable changes to this project will be documented in this file. This
project adheres to [Semantic Versioning](http://semver.org/).

## 0.1.2, 0.1.3
## 0.1.4

These releases are also release engineering tests, aimed at sorting out automated publishing of a Github Release and NuGet package.
This release decouples Github Releases from NuGet package updates.

## 0.1.0, 0.1.1
## 0.1.0, 0.1.1, 0.1.2, 0.1.3

These releases are release engineering tests, aimed at sorting out automated publishing of a Github Release and NuGet package.
2 changes: 1 addition & 1 deletion src/Styra.Opa.AspNetCore/Styra.Opa.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Styra.Opa.AspNetCore</PackageId>
<Version>0.1.0</Version>
<Version>0.1.4</Version>
<Authors>Styra</Authors>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>true</IsPackable>
Expand Down

0 comments on commit f31e4cf

Please sign in to comment.