汉化发行 #327
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 汉化发行 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release: | |
| description: "是否发行" | |
| type: boolean | |
| branch: | |
| type: string | |
| default: main | |
| description: "分支名" | |
| schedule: | |
| - cron: '0 15 * * *' # 每天北京时间23点(UTC+8, 等于UTC 15点) | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| backend: [vulkan] | |
| include: | |
| - backend: vulkan | |
| artifact_name: zed-release | |
| rustflags: "" | |
| steps: | |
| - name: Enable long paths in Git | |
| run: | | |
| git config --system core.longpaths true | |
| - name: Enable long paths in Windows | |
| shell: powershell | |
| run: | | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" ` | |
| -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
| - uses: actions/checkout@v4 | |
| - name: 设置 Python 3.10 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.10" | |
| - name: 手动同步 zed 源代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: zed-industries/zed | |
| ref: ${{ inputs.branch || 'main' }} | |
| path: zed | |
| - name: 替换 | |
| run: python3 replace.py | |
| - name: Install rust nightly | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: nightly | |
| override: true | |
| target: wasm32-wasip1 | |
| - name: Rust 缓存 | |
| uses: Swatinem/[email protected] | |
| with: | |
| key: ${{ matrix.backend }} | |
| workspaces: "zed -> target" | |
| - name: Install PSToml module | |
| shell: pwsh | |
| run: Install-Module -Name PSToml -Scope CurrentUser -Force | |
| - name: Setup rustflags | |
| shell: pwsh | |
| run: ./Parse-Rustflags.ps1 ${{ matrix.rustflags }} | |
| - name: 编译发行版 | |
| working-directory: zed | |
| run: cargo build --release --jobs 4 | |
| - name: Archive build | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: zed/target/release/zed.exe | |
| build-dpkg-x86: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: 设置 Python 3.10 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.10" | |
| - uses: actions/checkout@v4 | |
| - name: 手动同步 zed 源代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: zed-industries/zed | |
| ref: ${{ inputs.branch || 'main' }} | |
| path: zed | |
| - name: 替换 | |
| run: python3 replace.py | |
| - name: 将 Rust 添加到 PATH | |
| run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: 安装 Linux 依赖项 | |
| run: ./zed/script/linux && ./zed/script/install-mold 2.34.0 | |
| - name: 限制目标目录大小 | |
| run: zed/script/clear-target-dir-if-larger-than 100 | |
| - name: 创建 Linux .tar.gz 包 | |
| run: cd zed && script/bundle-linux | |
| - name: 移动文件 | |
| run: mv zed/target/release/zed*.tar.gz zed-linux-x86_64.tar.gz | |
| - name: 解压文件 | |
| run: tar -xvf zed-linux-x86_64.tar.gz | |
| - name: 上传文件 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zed-linux-x86_64 | |
| path: zed-linux-x86_64.tar.gz | |
| - name: 移动 | |
| run: mv zed-dev.app deb/usr | |
| - name: 权限修复 | |
| run: chmod 775 deb -R | |
| - name: 编译 | |
| run: dpkg-deb --build deb | |
| - name: 改名 | |
| run: mv deb.deb zed-linux-x86_64.deb | |
| - name: 上传文件 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zed-linux-x86_64.deb | |
| path: zed-linux-x86_64.deb | |
| build-dpkg-arm: | |
| runs-on: ubuntu-22.04-arm | |
| steps: | |
| - name: 设置 Python 3.10 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: "3.10" | |
| - uses: actions/checkout@v4 | |
| - name: 手动同步 zed 源代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: zed-industries/zed | |
| ref: ${{ inputs.branch || 'main' }} | |
| path: zed | |
| - name: 替换 | |
| run: python3 replace.py | |
| - name: 安装 Linux 依赖项 | |
| run: ./zed/script/linux | |
| - name: Setup Sentry CLI | |
| uses: matbour/setup-sentry-cli@3e938c54b3018bdd019973689ef984e033b0454b | |
| - name: 限制目标目录大小 | |
| run: zed/script/clear-target-dir-if-larger-than 100 | |
| - name: 创建 Linux .tar.gz 包 | |
| run: cd zed && script/bundle-linux | |
| - name: 移动 | |
| run: mv zed/target/release/zed*.tar.gz zed-linux-arm64.tar.gz | |
| - name: 解压文件 | |
| run: tar -xvf zed-linux-arm64.tar.gz | |
| - name: 上传文件 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zed-linux-arm64 | |
| path: zed-linux-arm64.tar.gz | |
| - name: 移动 | |
| run: mv zed-dev.app deb-arm/usr | |
| - name: 权限修复 | |
| run: chmod 775 deb-arm -R | |
| - name: 编译 | |
| run: dpkg-deb --build deb-arm | |
| - name: 改名 | |
| run: mv deb-arm.deb zed-linux-arm64.deb | |
| - name: 上传文件 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zed-linux-arm64.deb | |
| path: zed-linux-arm64.deb | |
| release: | |
| if: (github.event_name == 'schedule') || (github.event_name == 'workflow_dispatch' && inputs.release) | |
| needs: [build-windows, build-dpkg-x86, build-dpkg-arm] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download release artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Get the current date | |
| id: date | |
| run: echo "CURRENT_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
| - name: Create release directories and zip | |
| run: | | |
| mkdir -p zed-release | |
| mv artifacts/zed-release/zed.exe zed-release/ | |
| zip -r zed-windows.zip zed-release/* | |
| - name: linux | |
| run: | | |
| mv artifacts/zed-linux-x86_64.deb/zed-linux-x86_64.deb zed-linux-x86_64.deb | |
| mv artifacts/zed-linux-arm64.deb/zed-linux-arm64.deb zed-linux-arm64.deb | |
| mv artifacts/zed-linux-x86_64/zed-linux-x86_64.tar.gz zed-linux-x86_64.tar.gz | |
| mv artifacts/zed-linux-arm64/zed-linux-arm64.tar.gz zed-linux-arm64.tar.gz | |
| - name: build sha256 | |
| run: | | |
| sha256sum zed-windows.zip zed-linux-x86_64.deb zed-linux-arm64.deb zed-linux-x86_64.tar.gz zed-linux-arm64.tar.gz > sha256sums.txt | |
| - name: Upload release build artifacts to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: ${{ env.CURRENT_DATE }} | |
| tag_name: ${{ env.CURRENT_DATE }} | |
| draft: false | |
| make_latest: true | |
| files: | | |
| zed-windows.zip | |
| zed-linux-x86_64.deb | |
| zed-linux-arm64.deb | |
| zed-linux-x86_64.tar.gz | |
| zed-linux-arm64.tar.gz | |
| sha256sums.txt |