Skip to content

Commit

Permalink
Merge branch 'feature/conan' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
x37v committed Feb 20, 2025
2 parents 4248884 + 46e89fa commit 5002ff9
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 33 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,28 @@ jobs:
aptly repo add bookworm-rpi-beta rnbo-runner-panel_${{ needs.getversion.outputs.version }}.deb
aptly publish update -batch -passphrase=${{ secrets.APTLY_GPG_PASSWORD }} bookworm s3:c74:
publish_conan:
runs-on: [self-hosted, Linux, x64, digitalocean]
needs: [getversion]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: npm ci

- name: Build Conan Package
run: npm run package-conan
env:
PKG_VERSION: ${{ needs.getversion.outputs.version }}

- name: Publish Conan Package
shell: bash
run: |
conan remote add cycling ${{secrets.C74_CONAN_REMOTE_URL}}
conan user -r cycling -p ${{secrets.C74_CONAN_PASSWORD}} ${{secrets.C74_CONAN_USER}}
conan upload -r cycling --all rnborunnerpanel/${{ needs.getversion.outputs.version }}@c74/testing
21 changes: 21 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from conans import ConanFile, tools

class RNBORunnerPanelConan(ConanFile):
name = "rnborunnerpanel"
description = "Packaged build outputs from rnbo-runner-panel"
author = "Cycling'74"
url = "https://github.com/Cycling74/rnbo-runner-panel"
settings = None
license = "MIT"
no_copy_source = True

def export_sources(self):
self.copy("bin/**", src="build/usr/")
self.copy("share/**", src="build/usr/")

def build(self):
#do nothing
return

def package(self):
self.copy("*")
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@
"build": "next build",
"start": "next start",
"lint": "next lint",

"prepackage-debian": "npm run build",
"package-debian": "node scripts/package-debian.mjs",
"package-debian": "node scripts/package-linux.mjs --debian ./debian/",

"prepackage-linux": "npm run build",
"package-linux": "node scripts/package-linux.mjs ./build/",

"prepackage-conan": "npm run package-linux",
"package-conan": "node scripts/package-conan.mjs",

"preversion": "next lint"

},
"dependencies": {
"@dagrejs/dagre": "^1.1.4",
Expand Down
10 changes: 10 additions & 0 deletions scripts/package-conan.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { execSync } from "child_process";
import { readPkgInfoVersion } from "./utils.mjs";
import { dirname, join, resolve } from "path";
import { fileURLToPath } from "url";

const basedir = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const version = process.env.PKG_VERSION || readPkgInfoVersion(join(basedir, "package.json"));
const tag = "c74/testing";

execSync(`conan create . ${version}@${tag}`);
32 changes: 0 additions & 32 deletions scripts/package-debian.mjs

This file was deleted.

31 changes: 31 additions & 0 deletions scripts/package-linux.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { dirname, join, resolve } from "path";
import fs from "fs-extra";
import { fileURLToPath } from "url";
import { execSync } from "child_process";
import { readPkgInfoVersion } from "./utils.mjs";

const { readFileSync, writeFileSync, rmSync, copySync } = fs;

const debian = process.argv.includes("--debian");
const outdir = process.argv.at(-1);

const basedir = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const name = process.env.PKG_NAME || "rnbo-runner-panel";

// cleanup if we have an existing export
rmSync(join(outdir, "usr"), { recursive: true, force: true });

copySync(join(basedir, "out"), join(outdir, "usr", "share", name, "www"), { overwrite: true } );
copySync(join(basedir, "server.py"), join(outdir, "usr", "bin", name), { overwrite: true } );

//do debian specific packaging
if (debian) {
const version = process.env.PKG_VERSION || readPkgInfoVersion(join(basedir, "package.json"));
// add the version into the control file
const control = readFileSync(join(outdir, "DEBIAN", "control.in"), "utf8").replace(/[\s\n]*$/, "") + `\nVersion: ${version}\n`;
writeFileSync(join(outdir, "DEBIAN", "control"), control);

const deb = `${name}_${version}.deb`;
execSync(`dpkg-deb --build . ../${deb}`, { cwd: outdir });
console.log(`created ${deb}`);
}
8 changes: 8 additions & 0 deletions scripts/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import fs from "fs-extra";
const { readFileSync } = fs;

export const readPkgInfoVersion = fpath => {
const info = JSON.parse(readFileSync(fpath, { encoding: "utf8"} ));
if (!info.version) throw new Error("Missing version property in pacakge.json file");
return info.version;
};

0 comments on commit 5002ff9

Please sign in to comment.