mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2026-02-02 09:08:26 +00:00
ci: handle macOS code signing issues.
This commit is contained in:
94
.github/workflows/dotnet.yml
vendored
94
.github/workflows/dotnet.yml
vendored
@@ -9,55 +9,101 @@ on:
|
|||||||
branches: [ dev ]
|
branches: [ dev ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
# Windows 和 Linux 构建(保持在 Ubuntu 上)
|
||||||
|
build-linux-windows:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Get build version
|
- name: Get build version
|
||||||
id: date
|
id: date
|
||||||
run: echo "::set-output name=date::$(date +'%Y%m%d')${{github.run_number}}"
|
run: echo "date=$(date +'%Y%m%d')${{github.run_number}}" >> $GITHUB_OUTPUT
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 8.0.x
|
dotnet-version: 8.0.x
|
||||||
- name: Restore dependencies
|
- name: Publish Windows and Linux
|
||||||
run: dotnet restore
|
|
||||||
- name: Publish
|
|
||||||
working-directory: ./src/ZonyLrcTools.Cli
|
working-directory: ./src/ZonyLrcTools.Cli
|
||||||
run: |
|
run: |
|
||||||
ls -a
|
for platform in win-x64 linux-x64 win-arm64 linux-arm64; do
|
||||||
chmod +x ./publish.sh
|
dotnet publish -r "$platform" -c Release -p:PublishSingleFile=true -p:DebugType=none --self-contained true
|
||||||
./publish.sh
|
cd ./bin/Release/net8.0/"$platform"/publish/
|
||||||
mv ./TempFiles ../../
|
zip -r ./ZonyLrcTools_"$platform"_"${{ steps.date.outputs.date }}".zip ./
|
||||||
|
cd ../../../../../
|
||||||
|
mkdir -p ./TempFiles
|
||||||
|
mv ./bin/Release/net8.0/"$platform"/publish/*.zip ./TempFiles/
|
||||||
|
done
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
|
||||||
PUBLISH_VERSION: ${{ steps.date.outputs.date }}
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
retention-days: 90
|
retention-days: 90
|
||||||
name: release-files
|
name: release-files-linux-windows
|
||||||
path: |
|
path: ./src/ZonyLrcTools.Cli/TempFiles
|
||||||
./TempFiles
|
|
||||||
./versions/release.md
|
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.date.outputs.date }}
|
version: ${{ steps.date.outputs.date }}
|
||||||
|
|
||||||
|
# macOS 构建(在 macOS runner 上,支持 ad-hoc 签名)
|
||||||
|
build-macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Get build version
|
||||||
|
id: date
|
||||||
|
run: echo "date=$(date +'%Y%m%d')${{github.run_number}}" >> $GITHUB_OUTPUT
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: 8.0.x
|
||||||
|
- name: Publish macOS
|
||||||
|
working-directory: ./src/ZonyLrcTools.Cli
|
||||||
|
run: |
|
||||||
|
for platform in osx-x64 osx-arm64; do
|
||||||
|
dotnet publish -r "$platform" -c Release -p:PublishSingleFile=true -p:DebugType=none --self-contained true
|
||||||
|
|
||||||
|
# Ad-hoc 签名,解决 macOS Gatekeeper/XProtect 问题
|
||||||
|
codesign -s - --force --deep ./bin/Release/net8.0/"$platform"/publish/ZonyLrcTools.Cli
|
||||||
|
|
||||||
|
cd ./bin/Release/net8.0/"$platform"/publish/
|
||||||
|
zip -r ./ZonyLrcTools_"$platform"_"${{ steps.date.outputs.date }}".zip ./
|
||||||
|
cd ../../../../../
|
||||||
|
mkdir -p ./TempFiles
|
||||||
|
mv ./bin/Release/net8.0/"$platform"/publish/*.zip ./TempFiles/
|
||||||
|
done
|
||||||
|
shell: bash
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
retention-days: 90
|
||||||
|
name: release-files-macos
|
||||||
|
path: ./src/ZonyLrcTools.Cli/TempFiles
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.date.outputs.date }}
|
||||||
|
|
||||||
|
# Release Job - 合并所有平台的构建产物
|
||||||
release:
|
release:
|
||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
needs: build
|
needs: [build-linux-windows, build-macos]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact
|
- name: Checkout for release notes
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/checkout@v4
|
||||||
|
- name: Download Linux/Windows artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: release-files
|
name: release-files-linux-windows
|
||||||
path: .
|
path: ./TempFiles
|
||||||
|
- name: Download macOS artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-files-macos
|
||||||
|
path: ./TempFiles
|
||||||
- name: Upload Release
|
- name: Upload Release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
artifacts: "./TempFiles/*.zip"
|
artifacts: "./TempFiles/*.zip"
|
||||||
token: ${{ secrets.GITHUBACTIONS }}
|
token: ${{ secrets.GITHUBACTIONS }}
|
||||||
tag: ZonyLrcToolsX_Alpha.${{ needs.build.outputs.version }}
|
tag: ZonyLrcToolsX_Alpha.${{ needs.build-linux-windows.outputs.version }}
|
||||||
commit: dev
|
commit: dev
|
||||||
bodyFile: ./versions/release.md
|
bodyFile: ./versions/release.md
|
||||||
Reference in New Issue
Block a user