Skip to content

Commit 332db05

Browse files
committed
feat(ci): Add automatic NuGet.org publish and GitHub Release
- Auto publish to NuGet.org when version is specified - Auto create GitHub Release with package attachment - Auto detect pre-release from version string (preview/alpha/beta) - Requires NUGET_API_KEY secret to be configured
1 parent cf8e0e8 commit 332db05

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,45 @@ jobs:
4949
name: PublishAotCompressed.macOS.${{ github.event.inputs.version }}.nupkg
5050
path: src/bin/Debug/PublishAotCompressed.macOS.${{ github.event.inputs.version }}.nupkg
5151

52+
- name: Publish to NuGet.org
53+
if: ${{ github.event.inputs.version != '' }}
54+
run: |
55+
dotnet nuget push src/bin/Debug/PublishAotCompressed.macOS.${{ github.event.inputs.version }}.nupkg \
56+
--api-key ${{ secrets.NUGET_API_KEY }} \
57+
--source https://api.nuget.org/v3/index.json \
58+
--skip-duplicate
59+
5260
- name: Create Release Tag
5361
if: ${{ github.event.inputs.version != '' }}
5462
run: |
5563
git config user.name github-actions
5664
git config user.email github-actions@github.com
5765
git tag v${{ github.event.inputs.version }}
5866
git push origin v${{ github.event.inputs.version }}
67+
68+
- name: Create GitHub Release
69+
if: ${{ github.event.inputs.version != '' }}
70+
uses: softprops/action-gh-release@v1
71+
with:
72+
tag_name: v${{ github.event.inputs.version }}
73+
name: v${{ github.event.inputs.version }}
74+
body: |
75+
## PublishAotCompressed.macOS v${{ github.event.inputs.version }}
76+
77+
Automatic UPX compression for .NET Native AOT cross-compilation from macOS.
78+
79+
### Installation
80+
```xml
81+
<PackageReference Include="PublishAotCompressed.macOS" Version="${{ github.event.inputs.version }}" />
82+
```
83+
84+
### Quick Start
85+
```bash
86+
dotnet publish -r win-x64 -c Release
87+
```
88+
89+
See [README.md](https://github.com/interface95/PublishAotCompressed.macOS/blob/master/README.md) for details.
90+
files: src/bin/Debug/PublishAotCompressed.macOS.${{ github.event.inputs.version }}.nupkg
91+
prerelease: ${{ contains(github.event.inputs.version, 'preview') || contains(github.event.inputs.version, 'alpha') || contains(github.event.inputs.version, 'beta') }}
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)