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

Feature/conan #197

Merged
merged 5 commits into from
Feb 20, 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
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;
};