Update README.md #12
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: Release Toy OS | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust (OS) | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| targets: riscv64gc-unknown-none-elf | |
| components: rust-src, llvm-tools-preview | |
| - name: Setup Rust (User) | |
| # This step ensures the specific toolchain defined in user/rust-toolchain.toml is installed | |
| # before the build script runs, avoiding timeouts or silenced output during make. | |
| working-directory: user | |
| run: cargo --version | |
| - name: Install cargo-binutils | |
| run: cargo install cargo-binutils | |
| - name: Setup Emscripten | |
| uses: mymindstorm/setup-emsdk@v14 | |
| - name: Cache OpenSBI | |
| id: cache-opensbi | |
| uses: actions/cache@v3 | |
| with: | |
| path: opensbi-1.5.1-rv-bin | |
| key: ${{ runner.os }}-opensbi-v1.5.1 | |
| - name: Download and Build OpenSBI | |
| if: steps.cache-opensbi.outputs.cache-hit != 'true' | |
| run: | | |
| git clone https://github.com/riscv-software-src/opensbi.git | |
| cd opensbi | |
| git checkout v1.5.1 | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-riscv64-linux-gnu | |
| make PLATFORM=generic FW_OPTIONS=0x1 CROSS_COMPILE=riscv64-linux-gnu- | |
| mkdir -p ../opensbi-1.5.1-rv-bin/share/opensbi/lp64/generic/firmware/ | |
| cp build/platform/generic/firmware/fw_jump.bin \ | |
| ../opensbi-1.5.1-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.bin | |
| - name: Build OS | |
| working-directory: os | |
| run: | | |
| # Use the makefile to build the kernel and fs-img | |
| make build_env_check MODE=release | |
| - name: Package with Emscripten | |
| run: | | |
| $EMSDK/upstream/emscripten/tools/file_packager toy-os.data \ | |
| --preload ./opensbi-1.5.1-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.bin@fw_jump.bin \ | |
| --preload ./os/target/riscv64gc-unknown-none-elf/release/toy-os.bin@toy-os.bin \ | |
| --preload ./user/target/riscv64gc-unknown-none-elf/release/fs-nvme.img@fs-nvme.img \ | |
| --js-output=load-toy-os.js \ | |
| --export-es6 | |
| - name: Create Tag Name | |
| run: echo "TAG_NAME=v0.1.${{ github.run_number }}" >> $GITHUB_ENV | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ env.TAG_NAME }} | |
| name: Release ${{ env.TAG_NAME }} | |
| files: | | |
| toy-os.data | |
| load-toy-os.js | |
| ./os/target/riscv64gc-unknown-none-elf/release/toy-os.bin | |
| ./user/target/riscv64gc-unknown-none-elf/release/fs-nvme.img | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update portfolio website | |
| uses: ./.github/workflows/update-portfolio.yaml | |
| with: | |
| version: ${{ env.TAG_NAME }} |