forked from LagrangeDev/Lagrange.Core
-
Notifications
You must be signed in to change notification settings - Fork 1
183 lines (155 loc) · 6.36 KB
/
Lagrange.OneBot-release.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Lagrange.OneBot Release
on:
workflow_dispatch:
jobs:
Build:
runs-on: windows-latest
strategy:
matrix:
runtimeIdentifier:
[
win-x64,
win-x86,
linux-x64,
linux-arm,
linux-arm64,
osx-x64,
osx-arm64,
]
steps:
- uses: actions/checkout@v4
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Build Lagrange.OneBot .NET 8.0
shell: powershell
run: |
dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj --self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net8.0
- name: Upload binary files(${{ matrix.runtimeIdentifier }}) for .NET 8.0
uses: actions/upload-artifact@v3
with:
name: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0
path: Lagrange.OneBot/bin/Release/net8.0/${{ matrix.runtimeIdentifier }}/publish
- name: Compress files
run: Compress-Archive -Path 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\*' -DestinationPath 'Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip'
- name: dir
run: dir 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\'
- name: Rename
run: |
mkdir upload
copy 'Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip' 'upload/Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip'
# - name: Rename
# if: matrix.runtimeIdentifier == 'win-x64' || matrix.runtimeIdentifier == 'win-x86'
# run: move 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\Lagrange.OneBot.exe' 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\Lagrange.OneBot_${{ matrix.runtimeIdentifier }}.exe'
# - name: Rename
# if: matrix.runtimeIdentifier != 'win-x64' && matrix.runtimeIdentifier != 'win-x86'
# run: move 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\Lagrange.OneBot' 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\Lagrange.OneBot_${{ matrix.runtimeIdentifier }}'
- uses: fy0/r2-upload-action@1.4
continue-on-error: true
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: upload
destination-dir: ./lagrange/
- name: Prepare release files
uses: actions/upload-artifact@v3
with:
name: Lagrange.OneBot_all
path: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip
Build-Android:
runs-on: windows-latest
strategy:
matrix:
runtimeIdentifier:
[
linux-bionic-x64,
linux-bionic-arm64,
]
steps:
- uses: actions/checkout@v4
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Build Lagrange.OneBot arm .NET 8.0
shell: powershell
run: |
dotnet publish Lagrange.OneBot/Lagrange.OneBot.csproj --self-contained -p:PublishSingleFile=false -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:RuntimeIdentifier=${{ matrix.runtimeIdentifier }} --framework net8.0
- name: Copy Libraries
run: Copy-Item -Path 'Vendors\${{ matrix.runtimeIdentifier }}\*' -Destination "Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\" -Recurse -Force
- name: dir
run: dir 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\'
- name: Upload binary files(${{ matrix.runtimeIdentifier }}) for .NET 8.0
uses: actions/upload-artifact@v3
with:
name: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0
path: Lagrange.OneBot/bin/Release/net8.0/${{ matrix.runtimeIdentifier }}/publish
- name: Compress files
run: Compress-Archive -Path 'Lagrange.OneBot\bin\Release\net8.0\${{ matrix.runtimeIdentifier }}\publish\*' -DestinationPath 'Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip'
- name: Rename
if: matrix.runtimeIdentifier != 'win-x64' && matrix.runtimeIdentifier != 'win-x86'
run: |
mkdir upload
copy 'Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip' 'upload/Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip'
- uses: fy0/r2-upload-action@1.4
continue-on-error: true
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: upload
destination-dir: ./lagrange/
- name: Prepare release files
uses: actions/upload-artifact@v3
with:
name: Lagrange.OneBot_all
path: Lagrange.OneBot_${{ matrix.runtimeIdentifier }}_8.0.zip
NightlyRelease:
name: Nightly Release
runs-on: ubuntu-latest
needs:
- Build
- Build-Android
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update Nightly Tag
run: |
git tag -f nightly
git push -f origin nightly
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: Lagrange.OneBot_all
path: ./bin
- name: Update Nightly Release
uses: ncipollo/release-action@v1
with:
tag: nightly
name: "Nightly Release"
prerelease: true
body: "> ⚠️This is a nightly release.\n> ⚠️This is not the latest version."
artifacts: |
./bin/*
allowUpdates: true
removeArtifacts: true
ClearTempArtifacts:
name: Clear Temp Artifacts
if: always()
runs-on: ubuntu-latest
needs:
- NightlyRelease
permissions:
actions: write
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: |
Lagrange.OneBot_all