From 4f75538235929d1c7ce7898ef12d434ff0912f8c Mon Sep 17 00:00:00 2001 From: Stephen Bass Date: Fri, 1 Dec 2023 17:15:50 -0500 Subject: [PATCH] v1.0.0 -- unminipy release and autopublish of MacOS executables --- .github/workflows/main.yml | 51 ++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + README.md | 8 +++++- releases.md | 6 +++++ script/build.sh | 2 ++ todo.md | 8 +++--- 6 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/main.yml create mode 100644 releases.md create mode 100755 script/build.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..52707a9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,51 @@ +name: main + +on: + push: + tags: + - 'v[0-9]+\.[0-9]+\.[0-9]+' + +jobs: + build-and-release: + permissions: write-all + runs-on: macos-12 + steps: + - uses: actions/checkout@v4 + + - name: Configure Python3 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'pip' + + - name: Install pyinstaller + run: pip install pyinstaller && pip install -r requirements.txt + + - name: Bootstrap venv + run: script/init.sh && source script/env-up.sh + + - name: Build latest release + run: pyinstaller --onefile --paths unminipy-env/lib/python3.11/site-packages --hidden-import pyperclip -n unminipy unmini.py + + - name: Prep artifact + run: chmod 777 dist/unminipy && cd dist && zip unminipy.zip unminipy && cd - + + - name: Test artifact + run: dist/unminipy --clip + + - name: Release + uses: ncipollo/release-action@v1.13.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + allowUpdates: false + artifacts: "dist/unminipy.zip" + bodyFile: releases.md + draft: false + makeLatest: true + name: Release ${{ github.ref_name }} + prerelease: false + removeArtifacts: true + skipIfReleaseExists: true + tag: ${{ github.ref_name }} + diff --git a/.gitignore b/.gitignore index fea55e4..f1afab8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ __pycache__/ # pyinstaller build/ dist/ +*.tar.* # OS *.local diff --git a/README.md b/README.md index 9cbe985..22e1604 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ A small utility for unminifying minified JSON to assist with readability. ## script/ +### Using the venv + To initialize the venv: ```shell [unminipy]$ script/init.sh @@ -23,4 +25,8 @@ To deactivate the venv: (unminipy-env)[unminipy]$ source script/env-down.sh ``` - +### Building +```shell +# (with the venv active) +[unminipy]$ script/build.sh +``` diff --git a/releases.md b/releases.md new file mode 100644 index 0000000..fa7a35a --- /dev/null +++ b/releases.md @@ -0,0 +1,6 @@ +# v1.0.0 +unminipy v1: a simple executable that allows for converting minified JSON provided either thru the user's clipboard +or a local file into an unminified format. + +- v1.0.0's executable in GH releases only works for MacOS + - to use v1.0.0 on linux or windows, clone and follow the README.md diff --git a/script/build.sh b/script/build.sh new file mode 100755 index 0000000..e849242 --- /dev/null +++ b/script/build.sh @@ -0,0 +1,2 @@ +#!/bin/sh +pyinstaller --onefile --paths unminipy-env/lib/python3.11/site-packages --hidden-import pyperclip -n unminipy unmini.py diff --git a/todo.md b/todo.md index 526c59f..95a0ef3 100644 --- a/todo.md +++ b/todo.md @@ -1,8 +1,8 @@ ## ci/cd -- workflow for building & publishing - - pip install - - pyinstaller - - publish version to Github under repo releases +- in main.yml, publish a version per each host: + - linux + - ~~macos~~ + - windows ## bin - make a `--save` arg that will save the unminified output to a file