Skip to content

Commit 5735d6d

Browse files
committed
增加多平台支持
1 parent e929be2 commit 5735d6d

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,28 @@ jobs:
7777
rsync -a --delete web/dist/ src/OneCode/wwwroot/
7878
7979
- name: Build backend
80+
if: github.event_name != 'workflow_dispatch'
8081
run: dotnet build src/OneCode/OneCode.csproj -c Release -p:Version=${{ steps.version.outputs.version }} -p:InformationalVersion=${{ steps.version.outputs.version }}
8182

83+
- name: Publish backend
84+
if: github.event_name == 'workflow_dispatch'
85+
shell: bash
86+
run: |
87+
set -euo pipefail
88+
for RID in linux-x64 win-x64 osx-x64; do
89+
dotnet publish src/OneCode/OneCode.csproj -c Release -r "${RID}" --self-contained false -o "artifacts/publish/${RID}" -p:Version=${{ steps.version.outputs.version }} -p:InformationalVersion=${{ steps.version.outputs.version }}
90+
done
91+
92+
- name: Package release assets
93+
if: github.event_name == 'workflow_dispatch'
94+
shell: bash
95+
run: |
96+
set -euo pipefail
97+
mkdir -p artifacts
98+
tar -czf "artifacts/OneCode-${{ steps.version.outputs.version }}-linux-x64.tar.gz" -C artifacts/publish/linux-x64 .
99+
tar -czf "artifacts/OneCode-${{ steps.version.outputs.version }}-osx-x64.tar.gz" -C artifacts/publish/osx-x64 .
100+
(cd artifacts/publish/win-x64 && zip -r "../../OneCode-${{ steps.version.outputs.version }}-win-x64.zip" .)
101+
82102
- name: Create release
83103
if: github.event_name == 'workflow_dispatch'
84104
env:
@@ -88,5 +108,10 @@ jobs:
88108
run: |
89109
set -euo pipefail
90110
TAG="v${{ steps.version.outputs.version }}"
91-
gh release create "${TAG}" --title "${TAG}" --notes "${RELEASE_NOTES}" --target "${GITHUB_SHA}"
111+
ASSETS=(
112+
"artifacts/OneCode-${{ steps.version.outputs.version }}-linux-x64.tar.gz"
113+
"artifacts/OneCode-${{ steps.version.outputs.version }}-osx-x64.tar.gz"
114+
"artifacts/OneCode-${{ steps.version.outputs.version }}-win-x64.zip"
115+
)
116+
gh release create "${TAG}" "${ASSETS[@]}" --title "${TAG}" --notes "${RELEASE_NOTES}" --target "${GITHUB_SHA}"
92117

0 commit comments

Comments
 (0)