Fix mount image file #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build ruri riscv64 binary | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
check_ruri_update: | |
name: Check Ruri update | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Ruri version | |
id: check_ruri_version | |
run: | | |
local_version=$(curl -L --header 'authorization: Bearer ${{ github.token }}' https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name) | |
remote_version=$(curl -L https://api.github.com/repos/Moe-hacker/ruri/releases/latest | jq -r .tag_name) | |
echo local_version=$local_version | tee -a $GITHUB_OUTPUT | |
echo remote_version=$remote_version | tee -a $GITHUB_OUTPUT | |
outputs: | |
local_version: ${{ steps.check_ruri_version.outputs.local_version }} | |
remote_version: ${{ steps.check_ruri_version.outputs.remote_version }} | |
build: | |
name: Build Ruri | |
needs: check_ruri_update | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Set env | |
run: | | |
echo ruri_remote_version=${{ needs.check_ruri_update.outputs.remote_version }} | tee -a $GITHUB_ENV | |
echo build_time=$(TZ=Asia/Shanghai date '+%Y%m%d%H%M') | tee -a $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Install packages | |
id: runcmd | |
with: | |
arch: riscv64 | |
distro: ubuntu_latest | |
run: | | |
apt update | |
apt install -y \ | |
make \ | |
clang \ | |
libseccomp-dev \ | |
libcap-dev \ | |
libc6-dev \ | |
binutils&& cc -Wl,--gc-sections -static src/*.c -o ruri-riscv64 -lcap -lseccomp&&strip ruri-riscv64 | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.ruri_remote_version }} | |
body: | | |
This is ruri binary release. | |
Build time: ${{ env.build_time }} | |
prerelease: false | |
files: | | |
/home/runner/work/ruri/ruri/ruri-riscv64 |