From ede0a96dae9df1cf2c449dbb34c2c18d610116ef Mon Sep 17 00:00:00 2001 From: Bryce Thorup Date: Fri, 15 May 2026 10:37:03 -0600 Subject: [PATCH] init --- .gitea/workflows/push_to_main.yaml | 16 +++++++++++++ action.sh | 13 +++++++++++ action.yaml | 36 ++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 .gitea/workflows/push_to_main.yaml create mode 100644 action.sh create mode 100644 action.yaml diff --git a/.gitea/workflows/push_to_main.yaml b/.gitea/workflows/push_to_main.yaml new file mode 100644 index 0000000..d4b219c --- /dev/null +++ b/.gitea/workflows/push_to_main.yaml @@ -0,0 +1,16 @@ +name: Push to main + +on: + push: + branches: [main] + +jobs: + Reset-Version-Tag: + runs-on: debian-bullseye + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - run: git tag -d v1 || true + - run: git push --delete origin v1 || true + - run: git tag v1 + - run: git push --tags diff --git a/action.sh b/action.sh new file mode 100644 index 0000000..4e7acd4 --- /dev/null +++ b/action.sh @@ -0,0 +1,13 @@ +NAME=$(basename "$PWD") +VER=$(cat version) +DIR_NAME="$NAME"_"$VER" +TAR_NAME="$DIR_NAME".tar.gz +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" \ No newline at end of file diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..3955ffa --- /dev/null +++ b/action.yaml @@ -0,0 +1,36 @@ +name: mpy-publish +description: "publishes an mpy version of the latest version tag to a generic repository" +author: "Bryce Thorup" +inputs: + pypi_repo_user: + description: Username used for authenticating with repo + required: true + pypi_repo_pass: + description: Password used for authenticating with repo + required: true + pypi_repo_domain: + description: Domain for pypi repo + required: true +runs: + using: "composite" + steps: + - name: Update apt + run: apt update + + - name: Install pipx + run: apt install pipx + + - name: Install mpy-cross + run: pipx install mpy-cross + + - name: make "dist" dir + run: mkdir dist + + - name: Compile py files to mpy + run: for f in ./*.py; do pipx run mpy-cross "$f" -o dist/test/$(basename "$f" .py).mpy; done + + - name: Build project + run: source .venv/bin/activate && python -m build + + - name: Publish package + run: source .venv/bin/activate && python -m twine upload --repository repo ./dist/*