Skip to content

Commit 4b328b0

Browse files
committed
ci: make dev release reproducible
1 parent e2cf31c commit 4b328b0

1 file changed

Lines changed: 56 additions & 7 deletions

File tree

.github/workflows/dev-release.yaml

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,80 @@ on:
77
permissions:
88
contents: write
99

10+
concurrency:
11+
group: dev-release
12+
cancel-in-progress: true
13+
1014
jobs:
1115
build:
12-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-22.04
1317
steps:
14-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
1521

16-
- name: Install Rust toolchain
22+
- name: Install pinned Rust toolchain
1723
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
1831
1932
- 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
2157
2258
- name: Upload binary as artifact
23-
uses: actions/upload-artifact@v4
59+
uses: actions/upload-artifact@v7
2460
with:
2561
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
2766
2867
- name: Create dev release
2968
uses: softprops/action-gh-release@v2
3069
with:
3170
tag_name: dev
71+
target_commitish: ${{ github.sha }}
3272
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
3481
prerelease: true
3582
make_latest: false
83+
overwrite_files: true
84+
fail_on_unmatched_files: true
3685
env:
3786
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)