-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (132 loc) · 5.01 KB
/
publish-dotnet-binaries.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Publish .NET Core binaries
on:
push:
branches:
- main
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
jobs:
build_windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Create paths
run: |
md build
md release
- name: Compile binaries
run: |
$RUNTIMES = @("win-x64","win-arm64")
dotnet restore ./src/jsunmap.sln
dotnet build ./src/jsunmap.sln --configuration Release /p:WarningLevel=0
foreach ($RUNTIME in $RUNTIMES) {
echo "building $RUNTIME"
dotnet publish ./src/jsunmap.csproj --configuration Release --self-contained --runtime $RUNTIME --verbosity quiet -p:PublishTrimmed=true -o ./build/$RUNTIME /p:WarningLevel=0
Compress-Archive -Path ./build/$RUNTIME -DestinationPath ./release/JsUnMap-${{ github.run_number }}-$RUNTIME.zip
}
ls ./release/
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: |
JsUnMap-${{ github.run_number }}-win-x64.zip
JsUnMap-${{ github.run_number }}-win-arm64.zip
path: |
./release/JsUnMap-${{ github.run_number }}-win-x64.zip
./release/JsUnMap-${{ github.run_number }}-win-arm64.zip
build_linux:
runs-on: linux-latest
needs: [build_windows]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Create paths
run: |
md build
md release
- name: Compile binaries
run: |
$RUNTIMES = @("linux-x64","linux-arm64",)
dotnet restore ./src/jsunmap.sln
dotnet build ./src/jsunmap.sln --configuration Release /p:WarningLevel=0
foreach ($RUNTIME in $RUNTIMES) {
echo "building $RUNTIME"
dotnet publish ./src/jsunmap.csproj --configuration Release --self-contained --runtime $RUNTIME --verbosity quiet -p:PublishTrimmed=true -o ./build/$RUNTIME /p:WarningLevel=0
Compress-Archive -Path ./build/$RUNTIME -DestinationPath ./release/JsUnMap-${{ github.run_number }}-$RUNTIME.zip
}
ls ./release/
- name: Upload artifact
uses: actions/upload-artifact@v2
env:
GITHUB_TOKEN: ${{ secrets.BUILD_KEY }}
with:
name: |
JsUnMap-${{ github.run_number }}-linux-x64.zip
JsUnMap-${{ github.run_number }}-linux-arm64.zip
path: |
./release/JsUnMap-${{ github.run_number }}-linux-x64.zip
./release/JsUnMap-${{ github.run_number }}-linux-arm64.zip
create_publish:
needs: [build_windows,build_linux]
runs-on: windows-latest
steps:
- name: Create paths
run: |
md build
md release
- name: Get commit message
run: |
$COMMIT_MESSAGE = git log -1 --pretty=format:%s
Write-Host "::set-env name=COMMIT_MESSAGE::$COMMIT_MESSAGE"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.BUILD_KEY }}
with:
tag_name: v${{ github.run_number }}
release_name: Release v${{ github.run_number }}
body: |
Auto release.
${{ env.COMMIT_MESSAGE }}
draft: false
prerelease: false
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: |
JsUnMap-${{ github.run_number }}-win-x64.zip
JsUnMap-${{ github.run_number }}-win-arm64.zip
JsUnMap-${{ github.run_number }}-linux-x64.zip
JsUnMap-${{ github.run_number }}-linux-arm64.zip
path: ./release/
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.BUILD_KEY }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: |
./release/JsUnMap-${{ github.run_number }}-win-x64.zip
./release/JsUnMap-${{ github.run_number }}-win-arm64.zip
./release/JsUnMap-${{ github.run_number }}-linux-x64.zip
./release/JsUnMap-${{ github.run_number }}-linux-arm64.zip
asset_name: |
JsUnMap-${{ github.run_number }}-win-x64.zip
JsUnMap-${{ github.run_number }}-win-arm64.zip
JsUnMap-${{ github.run_number }}-linux-x64.zip
JsUnMap-${{ github.run_number }}-linux-arm64.zip
asset_content_type: |
application/zip
application/zip
application/zip
application/zip