Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add new release workflow #94

Merged
merged 5 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
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
80 changes: 79 additions & 1 deletion .fluentci/plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,84 @@ mod helpers;

use helpers::detect_system;

#[plugin_fn]
pub fn build(_arg: String) -> FnResult<String> {
let stdout = dag()
.pipeline("build")?
.pkgx()?
.with_workdir("./webui/rockbox")?
.with_exec(vec!["sudo", "apt-get", "update"])?
.with_exec(vec![
"sudo",
"apt-get install",
"-y",
"build-essential",
"libusb-dev",
"libsdl2-dev",
"libfreetype6-dev",
"libunwind-dev",
"curl",
"wget",
"zip",
"unzip",
"cmake",
])?
.with_exec(vec![
"pkgm",
"install",
"zig@0.13.0",
"buf",
"deno",
"bun",
"node@18",
])?
.with_exec(vec!["deno install"])?
.with_exec(vec!["deno", "run", "build"])?
.stdout()?;

// download & install protoc
dag()
.pipeline("protoc")?
.pkgx()?
.with_exec(vec![
"git",
"clone",
"https://github.com/protocolbuffers/protobuf",
])?
.with_exec(vec![
"cd protobuf &&",
"git checkout v29.2 &&",
"git submodule update --init --recursive &&",
"mkdir build &&",
"cd build &&",
"cmake .. && sudo make install -j$(nproc)",
])?
.stdout()?;

dag()
.pipeline("mkdir")?
.pkgx()?
.with_exec(vec!["mkdir", "-p", "build"])?
.stdout()?;

dag()
.pipeline("build")?
.pkgx()?
.with_workdir("build")?
.with_exec(vec![
"../tools/configure",
"--target=sdlapp",
"--type=N",
"--lcdwidth=320",
"--lcdheight=240",
"--prefix=/usr/local",
])?
.with_exec(vec!["sudo", "make", "ziginstall", "-j$(nproc)"])?
.stdout()?;

Ok(stdout)
}

#[plugin_fn]
pub fn release(_args: String) -> FnResult<String> {
let tag = dag().get_env("TAG")?;
Expand Down Expand Up @@ -129,7 +207,7 @@ pub fn release(_args: String) -> FnResult<String> {
}

#[plugin_fn]
pub fn build(args: String) -> FnResult<String> {
pub fn build_docker(args: String) -> FnResult<String> {
let version = dag()
.get_env("BUILDX_VERSION")
.unwrap_or("v0.17.1-desktop.1".into());
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: release
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
tag:
description: "The existing tag to publish"
type: "string"
required: true

jobs:
publish:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build and upload release
uses: fluentci-io/setup-fluentci@v5
with:
wasm: true
plugin: .
args: |
build
release
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ inputs.tag || github.ref_name }}
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ ENV PATH=/root/.local/bin:${PATH}

WORKDIR /app

RUN [ -n "$TAG" ] && fluentci run --wasm . release ; exit 0

FROM debian:bookworm

RUN apt-get update && apt-get install -y \
Expand Down
Loading