test_01
Push to main / Reset-Version-Tag (push) Successful in 6s

This commit is contained in:
2026-05-18 10:25:53 -06:00
parent 2e9a2b8d2c
commit d0e0907f8c
3 changed files with 60 additions and 17 deletions
+57
View File
@@ -0,0 +1,57 @@
import { execSync } from "child_process";
import { readFileSync, mkdirSync, writeFileSync, readdirSync } from "fs";
const libName = process.env.PWD;
const version = readFileSync("version", { encoding: "utf8" });
const repoBaseUrl = `${process.env.INPUT_REPO_URL}/${libName}/${version}`;
const packageJsonUrls = [];
const sendFile = async (path, data) => {
await fetch(`${repoBaseUrl}/${path}`, {
method: "PUT",
headers: {
Authorization: `Basic ${process.env.INPUT_REPO_USER}:${process.env.INPUT_REPO_PASS}`,
},
body: data,
});
};
// Get system utils
execSync("apt update", { encoding: "utf8" });
execSync("apt install -y pipx", { encoding: "utf8" });
execSync("pipx install mpy-cross", { encoding: "utf8" });
// Add base lib file to repo
await sendFile(`__init__.mpy`, new ArrayBuffer(0));
// Update urls
packageJsonUrls.push([`${libName}/__init__.mpy`, "__init__.mpy"]);
// Generate module folders/files
readdirSync(".")
.filter((f) => f.slice(-2) == "py")
.forEach(async (moduleFile) => {
const modName = moduleFile.slice(0, -3);
const modInitPath = `${modName}/__init__.mpy`;
const modPyPath = `${modName}/${modName}.mpy`;
// compile mpy file
execSync(`pipx run mpy-cross ${moduleFile}`, {
encoding: "utf8",
});
// Add module files to repo
await sendFile(modInitPath, new ArrayBuffer(0));
await sendFile(modPyPath, readFileSync(modPyPath).buffer);
// Update urls
packageJsonUrls.push([`${libName}/${modInitPath}`, modInitPath]);
packageJsonUrls.push([`${libName}/${modPyPath}`, modPyPath]);
});
// Add package.json to repo
await sendFile(`package.json`, {
urls: packageJsonUrls,
deps: [],
version: version,
});
-14
View File
@@ -1,14 +0,0 @@
NAME=$(basename "$PWD")
VER=$(cat version)
DIR_NAME="$NAME"_"$VER"
TAR_NAME="$NAME".tar.gz
echo $INPUT_REPO_URL
FULL_URL="$INPUT_REPO_URL"/"$NAME"/"$VER"/"$TAR_NAME"
apt update
apt install -y pipx
pipx install mpy-cross
mkdir "$DIR_NAME"
for f in ./*.py; do pipx run mpy-cross "$f" -o "$DIR_NAME"/$(basename "$f" .py).mpy; done
tar czf "$TAR_NAME" "$DIR_NAME"
curl -u "$INPUT_REPO_USER":"$INPUT_REPO_PASS" -X PUT -T "$TAR_NAME" "$FULL_URL"
+3 -3
View File
@@ -9,10 +9,10 @@ inputs:
description: Password used for authenticating with repo description: Password used for authenticating with repo
required: true required: true
repo_url: repo_url:
description: Domain for pypi repo description: Domain for package repo
required: true required: true
runs: runs:
using: "composite" using: "composite"
steps: steps:
- run: $GITHUB_ACTION_PATH/action.sh - run: $GITHUB_ACTION_PATH/action.js
shell: bash shell: node