microsoft/mu_feature_ffa
Publicmirrored from https://github.com/microsoft/mu_feature_ffaAvailable
.github/workflows/release-secure-partitions.yml
72lines · modecode
| 1 | # This workflow automatically publishes the rust secure partition binaries for a |
| 2 | # given release. |
| 3 | # |
| 4 | # Copyright (c) Microsoft Corporation. |
| 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent |
| 6 | # |
| 7 | |
| 8 | name: Rust Secure Partition Build |
| 9 | |
| 10 | on: |
| 11 | release: |
| 12 | types: |
| 13 | - published |
| 14 | pull_request: |
| 15 | branches: |
| 16 | - main |
| 17 | paths: |
| 18 | - ".github/workflows/release-secure-partitions.yml" |
| 19 | - "FfaFeaturePkg/**" |
| 20 | - "**/*.toml" |
| 21 | |
| 22 | env: |
| 23 | OUTOUTPUT_DIR: rust-secure-partitions |
| 24 | BUILD_TARGET: aarch64-unknown-none |
| 25 | |
| 26 | jobs: |
| 27 | build: |
| 28 | name: Build Rust Secure Partition |
| 29 | runs-on: ubuntu-latest |
| 30 | |
| 31 | permissions: |
| 32 | contents: write |
| 33 | |
| 34 | steps: |
| 35 | - name: Checkout Code |
| 36 | uses: actions/checkout@v7 |
| 37 | |
| 38 | - name: Install Rust Components |
| 39 | run: | |
| 40 | cargo install cargo-binutils |
| 41 | rustup target add ${{ env.BUILD_TARGET }} |
| 42 | rustup component add llvm-tools |
| 43 | |
| 44 | - name: Build Secure Partitions |
| 45 | run: | |
| 46 | mkdir -p ${{ env.OUTOUTPUT_DIR }} |
| 47 | |
| 48 | # arm-virt, TPM-disabled |
| 49 | cargo build --target=${{ env.BUILD_TARGET }} |
| 50 | cargo objcopy --target=${{ env.BUILD_TARGET }} -- -O binary ${{ env.OUTOUTPUT_DIR }}/msft-sp-virt.bin |
| 51 | cp target/${{ env.BUILD_TARGET }}/debug/msft-sp ${{ env.OUTOUTPUT_DIR }}/msft-sp-virt.elf |
| 52 | |
| 53 | # arm-virt, TPM-enabled |
| 54 | cargo build --target=${{ env.BUILD_TARGET }} --features tpm |
| 55 | cargo objcopy --target=${{ env.BUILD_TARGET }} --features tpm -- -O binary ${{ env.OUTOUTPUT_DIR }}/msft-sp-virt-tpm.bin |
| 56 | cp target/${{ env.BUILD_TARGET }}/debug/msft-sp ${{ env.OUTOUTPUT_DIR }}/msft-sp-virt-tpm.elf |
| 57 | |
| 58 | cp Cargo.lock ${{ env.OUTOUTPUT_DIR }}/Cargo.lock |
| 59 | |
| 60 | - name: Package Files |
| 61 | run: | |
| 62 | zip -r ${{ runner.temp }}/rust-secure-partitions-${{ github.event.release.tag_name }}.zip rust-secure-partitions/* ; |
| 63 | tar -czf ${{ runner.temp }}/rust-secure-partitions-${{ github.event.release.tag_name }}.tar.gz rust-secure-partitions/* |
| 64 | |
| 65 | - name: Upload Release Asset |
| 66 | if: github.event_name == 'release' |
| 67 | env: |
| 68 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | run: | |
| 70 | gh release upload ${{ github.event.release.tag_name }} ${{ runner.temp }}/rust-secure-partitions-*.zip |
| 71 | gh release upload ${{ github.event.release.tag_name }} ${{ runner.temp }}/rust-secure-partitions-*.tar.gz |
| 72 | |
| 73 | |