This repository was archived by the owner on Aug 18, 2025. It is now read-only.
构建CodeNothing解释器 #2
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: 构建CodeNothing解释器 | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - 'library_*/**' | |
| - '**.md' | |
| pull_request: | |
| branches: [ main ] | |
| paths-ignore: | |
| - 'library_*/**' | |
| - '**.md' | |
| workflow_dispatch: # 允许手动触发 | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: 构建解释器 | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| include: | |
| - os: windows-latest | |
| artifact_name: codenothing-windows | |
| asset_name: codenothing-windows.zip | |
| release_name: Windows | |
| - os: ubuntu-latest | |
| artifact_name: codenothing-linux | |
| asset_name: codenothing-linux.tar.gz | |
| release_name: Linux | |
| - os: macos-latest | |
| artifact_name: codenothing-macos | |
| asset_name: codenothing-macos.tar.gz | |
| release_name: macOS | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: 设置Rust工具链 | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: 构建 | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: build | |
| args: --release | |
| - name: 创建输出目录 | |
| run: mkdir -p release-package | |
| shell: bash | |
| - name: 打包Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| cp target/release/codenothing.exe release-package/ | |
| cp -r examples release-package/ | |
| 7z a ${{ matrix.asset_name }} ./release-package/* | |
| shell: bash | |
| - name: 打包Linux/macOS | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cp target/release/codenothing release-package/ | |
| cp -r examples release-package/ | |
| tar -czvf ${{ matrix.asset_name }} -C release-package . | |
| shell: bash | |
| - name: 上传构建产物 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ${{ matrix.asset_name }} | |
| - name: 创建发布 | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: ${{ matrix.asset_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |