Skip to content

Commit 60997ad

Browse files
committed
gha: add auto release publish
1 parent 66875d3 commit 60997ad

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release OKP.Core on Tag
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
release:
11+
name: publish-${{ matrix.target }}-${{ matrix.arch }}
12+
runs-on: ${{ matrix.os }}
13+
env:
14+
identifier: ${{ matrix.target }}-${{ matrix.arch }}
15+
strategy:
16+
matrix:
17+
target: [win, osx] # linux-musl
18+
arch: [x64, arm64]
19+
include:
20+
- os: windows-latest
21+
target: win
22+
# - os: windows-latest
23+
# target: linux-musl
24+
- os: macos-latest
25+
target: osx
26+
dotnet_version: ['9.x']
27+
dotnet_target: ['net9.0']
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup .NET
34+
uses: actions/setup-dotnet@v4
35+
with:
36+
dotnet-version: ${{ matrix.dotnet_version }}
37+
38+
- name: Prepare
39+
run: |
40+
dotnet nuget add source --username sun128764 --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/MIRIMIRIM/index.json"
41+
dotnet restore
42+
43+
- name: Publish the application
44+
run: |
45+
cd ./OKP.Core
46+
dotnet publish -c Release -r ${{ env.identifier }} -f ${{ matrix.dotnet_target }}
47+
7z a -t7z -mx9 "../OKP.Core-${{ env.identifier }}-Release.7z" "./bin/Release/${{ matrix.dotnet_target }}/${{ env.identifier }}/publish/*" "-x!*.pdb" "-x!*.dbg" "-x!*.dwarf" "-x!*.dSYM"
48+
49+
- name: Upload
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: OKP.Core_${{ env.identifier }}
53+
path: |
54+
OKP.Core/bin/Release/${{ matrix.dotnet_target }}/${{ env.identifier }}/publish/
55+
# OKP.Core-${{ env.identifier }}-Release.7z
56+
57+
- name: Create GitHub Release
58+
uses: softprops/action-gh-release@v2
59+
with:
60+
tag_name: ${{ github.ref_name }}
61+
files: OKP.Core-${{ env.identifier }}-Release.7z
62+
fail_on_unmatched_files: true
63+
generate_release_notes: false
64+
prerelease: false
65+
make_latest: 'true'

0 commit comments

Comments
 (0)