Skip to content

Commit

Permalink
feat: release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
giard-alexandre committed Aug 8, 2024
1 parent 2e406dc commit 915f6a8
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ indent_size = 2
[*.json]
indent_size = 2

[*.yml]
indent_size = 2

# Shell scripts
[*.sh]
end_of_line = lf
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/publish.yml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: 📞 Release Please

on:
push:
branches:
- main

defaults:
run:
working-directory: src

jobs:
release-please:
name: ✨ Release Please
runs-on: ubuntu-latest
outputs:
created: ${{ steps.release.outputs.release_created }}
version_major: ${{ steps.release.outputs.version_major }}
version_minor: ${{ steps.release.outputs.version_minor }}
version_patch: ${{ steps.release.outputs.version_patch }}
steps:
- name: ✨ Release Please
id: release
uses: googleapis/release-please-action@v4
with:
config-file: release-please/config.json
manifest-file: release-please/manifest.json

tag-commits:
name: 🏷️ Tag Commits
runs-on: ubuntu-latest
permissions:
contents: write # releases, tags
needs:
- release-please
if: ${{ needs.release.outputs.version_major && needs.release.outputs.version_minor && needs.release.outputs.version_patch }}
env:
V_MAJOR: ${{ steps.release.outputs.version_major }
V_MINOR: ${{ steps.release.outputs.version_minor }
V_PATCH: ${{ steps.release.outputs.version_patch }
steps:
- run: |
echo "Major version: ${{ steps.release.outputs.version_major }}"
echo "Minor version: ${{ steps.release.outputs.version_minor }}"
echo "Patch version: ${{ steps.release.outputs.version_patch }}"
echo "env Major version: ${{ env.V_MAJOR }}"
echo "env Minor version: ${{ env.V_MINOR }}"
echo "env Patch version: ${{ env.V_PATCH }}"
publish:
name: 📦 Publish to NuGet
runs-on: ubuntu-latest
permissions:
contents: write # releases, tags
needs:
- release-please
- tag-commits
if: ${{ needs.release-please.outputs.created }}
steps:
- name: 🛒 Checkout
uses: actions/checkout@v4
- name: 🟣 Setup .NET
uses: actions/setup-dotnet@v4
- name: 📦 Pack
run: >
dotnet pack
--configuration Release
- name: 🚀 Push to Nuget
run: >
dotnet nuget push
"nuget/*.nupkg"
--api-key ${{ secrets.NUGET_API_KEY }}
--source https://api.nuget.org/v3/index.json
--skip-duplicate
- name: 🚀 Push to Github Packages
run: >
dotnet nuget push
"nuget/*.nupkg"
--api-key ${{ secrets.GITHUB_TOKEN }}
--source https://nuget.pkg.github.com/Fonts.Avalonia/index.json
--skip-duplicate
26 changes: 26 additions & 0 deletions release-please/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"release-type": "simple",
"extra-files": ["src/Directory.Build.props"],
"changelog-sections": [
{
"type": "feat",
"section": "🚀 Features",
"hidden": false
},
{
"type": "fix",
"section": "🐛 Bug Fixes",
"hidden": false
},
{
"type": "build",
"section": "📦️ Build System, Dependencies",
"hidden": false
}
]
}
}
}
3 changes: 3 additions & 0 deletions release-please/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.5"
}
8 changes: 7 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
<PackageTags>c-sharp;xaml;cross-platform;dotnet;dotnetcore;avalonia;avaloniaui;fonts</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Authors>Alexandre Giard</Authors>
<!--x-release-please-start-version-->
<Version>0.0.5</Version>
<!--x-release-please-end-->
<!-- TODO: Sign? -->
<!-- <SignAssembly>True</SignAssembly>-->
<!-- <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Fonts.Avalonia.snk</AssemblyOriginatorKeyFile>-->
</PropertyGroup>

<!-- Add Debug Symbols-->
Expand All @@ -29,7 +35,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup Label="PackageIcon">
<ItemGroup Label="PackageIcon" Condition="'$(ProjectName.EndsWith(`Test`))' == 'false'">
<None Include="$(MSBuildThisFileDirectory)/../README.md" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>

Expand Down

0 comments on commit 915f6a8

Please sign in to comment.