|
7 | 7 | permissions: |
8 | 8 | contents: write |
9 | 9 |
|
| 10 | +concurrency: |
| 11 | + group: dev-release |
| 12 | + cancel-in-progress: true |
| 13 | + |
10 | 14 | jobs: |
11 | 15 | build: |
12 | | - runs-on: ubuntu-latest |
| 16 | + runs-on: ubuntu-22.04 |
13 | 17 | steps: |
14 | | - - uses: actions/checkout@v4 |
| 18 | + - uses: actions/checkout@v6 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
15 | 21 |
|
16 | | - - name: Install Rust toolchain |
| 22 | + - name: Install pinned Rust toolchain |
17 | 23 | uses: dtolnay/rust-toolchain@stable |
| 24 | + with: |
| 25 | + toolchain: "1.89.0" |
| 26 | + |
| 27 | + - name: Show toolchain |
| 28 | + run: | |
| 29 | + rustc --version --verbose |
| 30 | + cargo --version --verbose |
18 | 31 |
|
19 | 32 | - name: Build cloud-hypervisor (release) |
20 | | - run: cargo build --release |
| 33 | + run: | |
| 34 | + cargo build --release --bin cloud-hypervisor --features mshv |
| 35 | + strip target/release/cloud-hypervisor |
| 36 | +
|
| 37 | + - name: Generate checksum and build metadata |
| 38 | + run: | |
| 39 | + artifact=target/release/cloud-hypervisor |
| 40 | + sha256sum "$artifact" > "${artifact}.sha256" |
| 41 | + cat > target/release/build-info.json <<EOF |
| 42 | + { |
| 43 | + "ref": "${GITHUB_REF_NAME}", |
| 44 | + "commit": "${GITHUB_SHA}", |
| 45 | + "run_id": "${GITHUB_RUN_ID}", |
| 46 | + "run_attempt": "${GITHUB_RUN_ATTEMPT}", |
| 47 | + "workflow": "${GITHUB_WORKFLOW}", |
| 48 | + "rustc": "$(rustc --version --verbose | tr '\n' '; ' | sed 's/; $//')", |
| 49 | + "cargo": "$(cargo --version --verbose | tr '\n' '; ' | sed 's/; $//')" |
| 50 | + } |
| 51 | + EOF |
| 52 | +
|
| 53 | + - name: Move dev tag to current commit |
| 54 | + run: | |
| 55 | + git tag -f dev "${GITHUB_SHA}" |
| 56 | + git push origin refs/tags/dev --force |
21 | 57 |
|
22 | 58 | - name: Upload binary as artifact |
23 | | - uses: actions/upload-artifact@v4 |
| 59 | + uses: actions/upload-artifact@v7 |
24 | 60 | with: |
25 | 61 | name: cloud-hypervisor |
26 | | - path: target/release/cloud-hypervisor |
| 62 | + path: | |
| 63 | + target/release/cloud-hypervisor |
| 64 | + target/release/cloud-hypervisor.sha256 |
| 65 | + target/release/build-info.json |
27 | 66 |
|
28 | 67 | - name: Create dev release |
29 | 68 | uses: softprops/action-gh-release@v2 |
30 | 69 | with: |
31 | 70 | tag_name: dev |
| 71 | + target_commitish: ${{ github.sha }} |
32 | 72 | name: Dev Build |
33 | | - files: target/release/cloud-hypervisor |
| 73 | + body: | |
| 74 | + Branch: `${{ github.ref_name }}` |
| 75 | + Commit: `${{ github.sha }}` |
| 76 | + Workflow Run: `${{ github.run_id }}` |
| 77 | + files: | |
| 78 | + target/release/cloud-hypervisor |
| 79 | + target/release/cloud-hypervisor.sha256 |
| 80 | + target/release/build-info.json |
34 | 81 | prerelease: true |
35 | 82 | make_latest: false |
| 83 | + overwrite_files: true |
| 84 | + fail_on_unmatched_files: true |
36 | 85 | env: |
37 | 86 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments