Skip to content

Commit

Permalink
CI: Publish binaries using GitHub Actions on new tag
Browse files Browse the repository at this point in the history
Because of time constraints and because the workflow itself
may need some additional work to support multiple operating systems
without making individual releases for every target architecture
and operating system, builds are only generated for Linux (amd64).

New releases are marked as "Drafts" by default, so as to allow
maintainers to edit the text before publication.

Fixes hermit-os#256
  • Loading branch information
n0toose committed Jun 13, 2024
1 parent c11286c commit a223a96
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Clippy
run: cargo clippy --all-targets ${{ matrix.flags }} -- -D warnings

clippy-test-kernel:
name: Clippy test-kernels
runs-on: ubuntu-latest
Expand All @@ -124,7 +124,7 @@ jobs:
# TODO: Remove once we have a hermit toolchain upgrade
# capable of sparse registries
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git

coverage:
name: Coverage
runs-on: [self-hosted]
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
push:
tags:
- "v*.*.*"

env:
GH_TOKEN: ${{ github.token }}

jobs:
release:
name: Create new release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
filename_suffix: "${{ github.ref_name }}-linux-amd64"
steps:
- uses: actions/checkout@v4
- run: gh release create ${{ github.ref }} --draft --title "Uhyve ${{ github.ref_name }}"
if: startsWith(matrix.os, 'ubuntu')
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --release --locked
# Adapted from: https://github.com/mkroening/edu-sync/blob/main/.github/workflows/release.yml
- name: Create archive
run: |
DIST=uhyve-${{ matrix.filename_suffix }}
mkdir $DIST
mv target/release/uhyve $DIST
cp README.md $DIST
cp LICENSE-* $DIST
tar czf $DIST.tar.gz $DIST
echo "FILE=$DIST.tar.gz" >> $GITHUB_ENV
- run: gh release upload ${{ github.ref }} $FILE
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
/target
# Taken from: https://github.com/github/gitignore/blob/main/Rust.gitignore
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Coverage
lcov.info
*.profraw
*.profdata

.vscode
#
.vscode
.DS_Store

0 comments on commit a223a96

Please sign in to comment.