|
| 1 | +name: Release Toy OS |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main", "master" ] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-and-release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup Rust (OS) |
| 19 | + uses: dtolnay/rust-toolchain@nightly |
| 20 | + with: |
| 21 | + targets: riscv64gc-unknown-none-elf |
| 22 | + components: rust-src, llvm-tools-preview |
| 23 | + |
| 24 | + - name: Setup Rust (User) |
| 25 | + # This step ensures the specific toolchain defined in user/rust-toolchain.toml is installed |
| 26 | + # before the build script runs, avoiding timeouts or silenced output during make. |
| 27 | + working-directory: user |
| 28 | + run: cargo --version |
| 29 | + |
| 30 | + - name: Install cargo-binutils |
| 31 | + run: cargo install cargo-binutils |
| 32 | + |
| 33 | + - name: Setup Emscripten |
| 34 | + uses: mymindstorm/setup-emsdk@v14 |
| 35 | + |
| 36 | + - name: Download OpenSBI |
| 37 | + run: | |
| 38 | + wget https://github.com/riscv-software-src/opensbi/releases/download/v1.5.1/opensbi-1.5.1-rv-bin.tar.xz |
| 39 | + tar -xf opensbi-1.5.1-rv-bin.tar.xz |
| 40 | +
|
| 41 | + - name: Build OS |
| 42 | + working-directory: os |
| 43 | + run: | |
| 44 | + # Use the makefile to build the kernel and fs-img |
| 45 | + make build_env_check MODE=release |
| 46 | +
|
| 47 | + - name: Package with Emscripten |
| 48 | + run: | |
| 49 | + file_packager toy-os.data \ |
| 50 | + --preload ./opensbi-1.5.1-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.bin@fw_jump.bin \ |
| 51 | + --preload ./os/target/riscv64gc-unknown-none-elf/release/[email protected] \ |
| 52 | + --preload ./user/target/riscv64gc-unknown-none-elf/release/[email protected] \ |
| 53 | + --js-output=load-toy-os.js \ |
| 54 | + --export-es6 |
| 55 | +
|
| 56 | + - name: Create Tag Name |
| 57 | + run: echo "TAG_NAME=v0.1.${{ github.run_number }}" >> $GITHUB_ENV |
| 58 | + |
| 59 | + - name: Create Release |
| 60 | + uses: softprops/action-gh-release@v1 |
| 61 | + with: |
| 62 | + tag_name: ${{ env.TAG_NAME }} |
| 63 | + name: Release ${{ env.TAG_NAME }} |
| 64 | + files: | |
| 65 | + toy-os.data |
| 66 | + load-toy-os.js |
| 67 | + ./os/target/riscv64gc-unknown-none-elf/release/toy-os.bin |
| 68 | + ./user/target/riscv64gc-unknown-none-elf/release/fs-nvme.img |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + |
| 72 | + # - name: Trigger External Pipeline |
| 73 | + # uses: peter-evans/repository-dispatch@v3 |
| 74 | + # with: |
| 75 | + # # You must create a Personal Access Token (PAT) with repo scope and add it as a secret named PAT_TOKEN |
| 76 | + # token: ${{ secrets.PAT_TOKEN }} |
| 77 | + # # TODO: Replace with the actual repository you want to trigger (e.g., username/repo-name) |
| 78 | + # repository: username/other-repo |
| 79 | + # event-type: toy-os-release |
| 80 | + # client-payload: '{"version": "${{ env.TAG_NAME }}"}' |
0 commit comments