Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Release

on:
push:
tags:
- "v*"
release:
types: [published]

permissions:
contents: write
Expand All @@ -24,7 +23,7 @@ jobs:
- name: Verify tag is on main
run: |
git fetch origin main
tag_commit="$(git rev-list -n 1 "$GITHUB_REF_NAME")"
tag_commit="$(git rev-list -n 1 "${{ github.event.release.tag_name }}")"
git merge-base --is-ancestor "$tag_commit" origin/main

- run: rustup toolchain install
Expand All @@ -33,21 +32,24 @@ jobs:

- name: Build static binary
run: |
TAG="${{ github.event.release.tag_name }}"
cargo build --release --target x86_64-unknown-linux-musl --locked
mkdir -p dist
cp target/x86_64-unknown-linux-musl/release/guestd "dist/guestd-${GITHUB_REF_NAME}-x86_64-linux-musl"
chmod +x "dist/guestd-${GITHUB_REF_NAME}-x86_64-linux-musl"
cp target/x86_64-unknown-linux-musl/release/guestd "dist/guestd-${TAG}-x86_64-linux-musl"
chmod +x "dist/guestd-${TAG}-x86_64-linux-musl"

- name: Build rootfs EROFS image
run: |
TAG="${{ github.event.release.tag_name }}"
./scripts/build-rootfs.sh \
target/x86_64-unknown-linux-musl/release/guestd \
"dist/rootfs-${GITHUB_REF_NAME}-x86_64.erofs"
"dist/rootfs-${TAG}-x86_64.erofs"

- name: Upload release artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
binary="dist/guestd-${GITHUB_REF_NAME}-x86_64-linux-musl"
rootfs="dist/rootfs-${GITHUB_REF_NAME}-x86_64.erofs"
gh release upload "$GITHUB_REF_NAME" "$binary" "$rootfs" --clobber
TAG="${{ github.event.release.tag_name }}"
binary="dist/guestd-${TAG}-x86_64-linux-musl"
rootfs="dist/rootfs-${TAG}-x86_64.erofs"
gh release upload "$TAG" "$binary" "$rootfs" --clobber