-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (73 loc) · 2.27 KB
/
mypublish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Many Thanks to PATRIK SVENSSON for this excelent 'template' !!!
# see : https://patriksvensson.se/2020/03/creating-release-artifacts-with-github-actions
name: MyPublish
on:
release:
types: [published]
pull_request:
branches:
- master
types:
- closed
workflow_dispatch:
jobs:
release:
# if: github.event.pull_request.merged == true
name: Release
strategy:
matrix:
kind: ['linux', 'windows']
include:
- kind: linux
os: ubuntu-latest
target: linux-x64
options: /p:PublishSingleFile=true
- kind: windows
os: windows-latest
target: win-x64
options: //p:PublishSingleFile=true
# - kind: macOS
# os: macos-latest
# target: osx-x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build
shell: bash
run: |
echo "tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
release_name="App-$tag-${{ matrix.target }}"
# Build everything
dotnet publish StatusConsole/StatusConsole.csproj --framework net8.0 --self-contained --runtime "${{ matrix.target }}" -c Release -o "$release_name" "${{ matrix.options }}"
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack to zip for Windows
7z a -tzip "${release_name}.zip" "./${release_name}/*"
else
tar czvf "${release_name}.tar.gz" "$release_name"
fi
# Delete output directory
rm -r "$release_name"
#- name: Publish
# uses: softprops/action-gh-release@v1
# with:
# tag: "Rel${{ env.tag }}"
# files: "App*"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create-Release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "Rel_${{ env.tag }}"
release_name: "Rel_${{ env.tag }}"
files: "App*"
draft: false
prerelease: false