|
9 | 9 | workflow_dispatch:
|
10 | 10 |
|
11 | 11 | jobs:
|
12 |
| - build: |
| 12 | + build-nightly: |
13 | 13 | runs-on: ${{ matrix.os }}
|
14 | 14 | strategy:
|
| 15 | + fail-fast: false |
15 | 16 | matrix:
|
16 |
| - os: [ubuntu-latest, windows-latest, macos-latest] |
| 17 | + os: [ubuntu-latest, windows-latest] |
| 18 | + arch: [x86, x64, arm, arm64, amd64] |
17 | 19 |
|
18 | 20 | steps:
|
19 | 21 | - name: 检出代码
|
| 22 | + if: ${{ !((runner.os == 'Linux' && matrix.arch == 'x86') || (runner.os == 'Windows' && matrix.arch == 'arm')) }} |
20 | 23 | uses: actions/checkout@v4
|
21 | 24 |
|
22 | 25 | - name: 设置 .NET 8.0.x
|
| 26 | + if: ${{ !((runner.os == 'Linux' && matrix.arch == 'x86') || (runner.os == 'Windows' && matrix.arch == 'arm')) }} |
23 | 27 | uses: actions/setup-dotnet@v4
|
24 | 28 | with:
|
25 | 29 | dotnet-version: '8.0.x'
|
26 | 30 |
|
27 | 31 | - name: 设置 Python 3.x
|
| 32 | + if: ${{ !((runner.os == 'Linux' && matrix.arch == 'x86') || (runner.os == 'Windows' && matrix.arch == 'arm')) }} |
28 | 33 | uses: actions/setup-python@v5
|
29 | 34 | with:
|
30 | 35 | python-version: '3.x'
|
31 | 36 |
|
32 |
| - - name: 生成版本号 - Unix |
33 |
| - if: runner.os == 'Linux' || runner.os == 'macOS' |
| 37 | + - name: 生成版本号 |
| 38 | + if: ${{ !((runner.os == 'Linux' && matrix.arch == 'x86') || (runner.os == 'Windows' && matrix.arch == 'arm')) }} |
| 39 | + shell: bash |
34 | 40 | run: |
|
35 | 41 | echo "NIGHTLY_VERSION=$(date +'%Y.%m.%d').${{ github.run_id }}" >> $GITHUB_ENV
|
36 |
| - echo "Generated version: $NIGHTLY_VERSION" |
37 |
| -
|
38 |
| - - name: 生成版本号 - Windows |
39 |
| - if: runner.os == 'Windows' |
40 |
| - run: | |
41 |
| - $date = Get-Date -Format "yyyy.MM.dd" |
42 |
| - $version = "$date.${{ github.run_id }}" |
43 |
| - echo "NIGHTLY_VERSION=$version" >> $env:GITHUB_ENV |
44 |
| - echo "Generated version: ${{ env.NIGHTLY_VERSION }}" |
45 | 42 |
|
46 | 43 | - name: 更新版本号
|
| 44 | + if: ${{ !((runner.os == 'Linux' && matrix.arch == 'x86') || (runner.os == 'Windows' && matrix.arch == 'arm')) }} |
| 45 | + env: |
| 46 | + PYTHONIOENCODING: utf-8 |
47 | 47 | run: |
|
48 |
| - python "auto-scripts/Change-Version.py" "${{ env.NIGHTLY_VERSION }}" |
| 48 | + python "自动化脚本/修改版本号.py" "${{ env.NIGHTLY_VERSION }}" |
49 | 49 |
|
50 |
| - - name: 还原依赖 |
51 |
| - run: dotnet restore ghv/ghv.csproj |
| 50 | + - name: 更新架构信息 |
| 51 | + if: ${{ !((runner.os == 'Linux' && matrix.arch == 'x86') || (runner.os == 'Windows' && matrix.arch == 'arm')) }} |
| 52 | + env: |
| 53 | + PYTHONIOENCODING: utf-8 |
| 54 | + run: | |
| 55 | + python "自动化脚本/修改架构.py" "${{ matrix.arch }}" |
52 | 56 |
|
53 |
| - - name: 构建 |
54 |
| - run: dotnet build ghv/ghv.csproj --configuration Release --no-restore |
| 57 | + - name: 发布 - Windows - x64/x86/arm64/amd64 |
| 58 | + if: ${{ runner.os == 'Windows' && matrix.arch != 'arm' }} |
| 59 | + run: | |
| 60 | + dotnet publish ghv/ghv.csproj --configuration Release --output ./output -r win-${{ matrix.arch }} |
| 61 | + dotnet publish ghv/ghv.csproj --configuration Release --output ./output_SingleFile -r win-${{ matrix.arch }} /p:PublishSingleFile=true /p:PublishTrimmed=true |
55 | 62 |
|
56 |
| - - name: 发布 |
57 |
| - run: dotnet publish ghv/ghv.csproj --configuration Release --no-build --output ./output |
| 63 | + - name: 发布 - linux - x64/arm/arm64/amd64 |
| 64 | + if: ${{ runner.os == 'Linux' && matrix.arch != 'x86' }} |
| 65 | + run: | |
| 66 | + dotnet publish ghv/ghv.csproj --configuration Release --output ./output -r linux-${{ matrix.arch }} |
| 67 | + dotnet publish ghv/ghv.csproj --configuration Release --output ./output_SingleFile -r linux-${{ matrix.arch }} /p:PublishSingleFile=true /p:PublishTrimmed=true |
58 | 68 |
|
59 | 69 | - name: 创建发行文件 - Windows
|
60 |
| - if: runner.os == 'Windows' |
| 70 | + if: ${{ runner.os == 'Windows' && matrix.arch != 'arm' }} |
| 71 | + shell: pwsh |
61 | 72 | run: |
|
62 | 73 | # 创建Release目录
|
63 | 74 | mkdir -p Release
|
64 | 75 |
|
65 | 76 | # 使用7z压缩为zip格式
|
66 |
| - 7z a -tzip Release/GitHubView-${{ env.NIGHTLY_VERSION }}-windows.zip output/* |
| 77 | + 7z a -tzip Release/GitHubView-${{ env.NIGHTLY_VERSION }}-${{ matrix.os }}-${{ matrix.arch }}.zip output/* |
67 | 78 |
|
68 | 79 | # 创建安装包
|
69 | 80 | curl -o "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl" "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl"
|
70 | 81 | iscc installer/Windows.iss
|
71 |
| - move installer/GitHubView-installer.exe Release/GitHubView-${{ env.NIGHTLY_VERSION }}-Setup-windows.exe |
| 82 | + iscc installer/SingleFile/Windows.iss |
| 83 | + move installer/GitHubView-installer.exe Release/GitHubView-${{ env.NIGHTLY_VERSION }}-${{ matrix.os }}-${{ matrix.arch }}-Setup.exe |
| 84 | + move installer/SingleFile/GitHubView-installer.exe Release/GitHubView-${{ env.NIGHTLY_VERSION }}-${{ matrix.os }}-${{ matrix.arch }}-Setup-SingleFile.exe |
| 85 | +
|
| 86 | + # 单独处理单文件 |
| 87 | + move output_SingleFile/ghv.exe Release/GitHubView-${{ env.NIGHTLY_VERSION }}-${{ matrix.os }}-${{ matrix.arch }}-SingleFile.exe |
72 | 88 |
|
73 | 89 | - name: 创建发行文件 - Linux
|
74 |
| - if: runner.os == 'Linux' |
75 |
| - env: |
76 |
| - MAINTAINER_EMAIL: ${{ secrets.Maintainer_Email }} |
| 90 | + if: ${{ runner.os == 'Linux' && matrix.arch != 'x86' }} |
| 91 | + shell: bash |
77 | 92 | run: |
|
78 | 93 | # 创建Release目录
|
79 |
| - mkdir -p Release |
| 94 | + mkdir -pv Release |
| 95 | +
|
| 96 | + echo "构建tar包..." |
80 | 97 |
|
81 | 98 | # 使用tar压缩
|
82 |
| - tar -czvf Release/GitHubView-${{ env.NIGHTLY_VERSION }}-linux.tar.gz -C output . |
83 |
| -
|
84 |
| - # 安装 dpkg |
85 |
| - sudo apt-get update |
86 |
| - sudo apt-get install -y dpkg |
87 |
| - # 创建 DEBIAN 目录和控制文件 |
88 |
| - mkdir -p output/DEBIAN |
89 |
| - echo 'Package: GitHubView' > output/DEBIAN/control |
90 |
| - echo 'Version: ${{ env.NIGHTLY_VERSION }}' >> output/DEBIAN/control |
91 |
| - echo 'Section: base' >> output/DEBIAN/control |
92 |
| - echo 'Priority: optional' >> output/DEBIAN/control |
93 |
| - echo 'Architecture: all' >> output/DEBIAN/control |
94 |
| - echo "Maintainer: 鸭鸭「カモ」 <${MAINTAINER_EMAIL}>" >> output/DEBIAN/control |
95 |
| - echo 'Description: GHV Application' >> output/DEBIAN/control |
96 |
| - # 生成安装包 |
97 |
| - dpkg --build output ghv.deb |
98 |
| - mv ghv.deb Release/GitHubView-${{ env.NIGHTLY_VERSION }}-linux.deb |
| 99 | + tar -czvf Release/GitHubView-${{ env.NIGHTLY_VERSION }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz -C output . |
99 | 100 |
|
100 |
| - - name: 创建发行文件 - macOS |
101 |
| - if: runner.os == 'macOS' |
102 |
| - run: | |
103 |
| - # 创建Release目录 |
104 |
| - mkdir -p Release |
| 101 | + # ======================================================= |
| 102 | + echo "构建DEB包..." |
| 103 | + mkdir -pv output_SingleFile/usr/local/bin/ |
| 104 | + cp -pv output_SingleFile/ghv output_SingleFile/usr/local/bin/ |
105 | 105 |
|
106 |
| - # 使用tar压缩 |
107 |
| - tar -czvf Release/GitHubView-${{ env.NIGHTLY_VERSION }}-macos.tar.gz -C output . |
| 106 | + # 复制 DEBIAN 控制文件 |
| 107 | + cp -rpv installer/SingleFile/DEBIAN output_SingleFile |
108 | 108 |
|
109 |
| - # 创建安装包 |
110 |
| - pkgbuild --root ./output --identifier DuckStudio.GitHubView --version ${{ env.NIGHTLY_VERSION }} --install-location /Applications --scripts ./output GitHubView.pkg |
111 |
| - mv GitHubView.pkg Release/GitHubView-${{ env.NIGHTLY_VERSION }}-macos.pkg |
| 109 | + # 生成安装包 |
| 110 | + dpkg --build output_SingleFile ghv.deb |
| 111 | + mv -v ghv.deb Release/GitHubView-${{ env.NIGHTLY_VERSION }}-${{ matrix.os }}-${{ matrix.arch }}.deb |
| 112 | +
|
| 113 | + # 验证安装包 |
| 114 | + dpkg --info Release/GitHubView-${{ env.NIGHTLY_VERSION }}-${{ matrix.os }}-${{ matrix.arch }}.deb |
| 115 | + dpkg --contents Release/GitHubView-${{ env.NIGHTLY_VERSION }}-${{ matrix.os }}-${{ matrix.arch }}.deb |
| 116 | +
|
| 117 | + # ======================================================= |
| 118 | + echo "发布单文件..." |
| 119 | + # 单独处理单文件 |
| 120 | + mv -v output_SingleFile/ghv Release/GitHubView-${{ env.NIGHTLY_VERSION }}-${{ matrix.os }}-${{ matrix.arch }}-SingleFile |
112 | 121 |
|
113 | 122 | - name: 发布 Nightly 版本
|
114 | 123 | uses: softprops/action-gh-release@v2
|
| 124 | + if: ${{ !((runner.os == 'Linux' && matrix.arch == 'x86') || (runner.os == 'Windows' && matrix.arch == 'arm')) }} |
115 | 125 | with:
|
116 | 126 | name: GitHubView Nightly Release (${{ env.NIGHTLY_VERSION }})
|
117 | 127 | tag_name: ${{ env.NIGHTLY_VERSION }}
|
|
0 commit comments