Browse Source

chore: add the ci itch exporter for theDumbPaintTool

pull/382/head
Parodi, Eugenio 🌶 12 months ago
parent
commit
549789be75
  1. 62
      .github/workflows/itch-publish.yml
  2. 2
      .github/workflows/release-sandbox-bin.yml
  3. 12
      apps/dumbPaintTool/dumbPaintTool/web.ttk.package.json
  4. 30
      apps/dumbPaintTool/main.py
  5. 10
      apps/dumbPaintTool/web.ttk.package.json
  6. 2
      tools/check.import.sh
  7. 20
      tools/webExporterInit.sh

62
.github/workflows/itch-publish.yml

@ -0,0 +1,62 @@
name: Upload itch.io Package
on:
workflow_dispatch:
inputs:
pkg_name:
description: the name of the project
type: string
required: true
# pkg_folder:
# description: the folder containing the pyproject.toml file
# type: string
# required: true
workflow_call:
inputs:
pkg_name:
description: the name of the project
type: string
required: true
# pkg_folder:
# description: the folder containing the pyproject.toml file
# type: string
# required: true
# release:
# types: [published]
permissions:
contents: read
jobs:
release-build:
# runs-on: ubuntu-latest
runs-on: self-hosted
# defaults:
# run:
# working-directory: ${{ inputs.pkg_folder }}
steps:
- uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: "3.x"
- name: Install Butler
shell: bash
run: |
# Download the latest stable version
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip butler.zip
chmod +x butler
- name: create web package
shell: bash
run: |
tools/webExporterInit.sh
- name: Upload to itch.io
env:
BUTLER_CREDENTIALS: ${{ secrets.ITCHIO_TOKEN }}
shell: bash
run: |
echo ${BUTLER_CREDENTIALS} > ~/.config/itch/butler_creds
./butler push dist/* ${{ secrets.ITCHIO_USER }}/${{ inputs.pkg_name }}:html5
./butler logout --assume-yes

2
.github/workflows/release-sandbox-bin.yml

@ -1,4 +1,4 @@
name: Release Sandbox name: Release Sandbox Binaries
on: on:
workflow_dispatch: workflow_dispatch:

12
apps/dumbPaintTool/dumbPaintTool/web.ttk.package.json

@ -1,12 +0,0 @@
{
"libs" : [
{"pkg" :"bin/TermTk.tgz",
"name": "TermTk"},
{"pkg" :"bin/DPT.tgz",
"name": "Dumb Paint Tool"}
],
"pkgs" : [
"Pillow"
],
"main": "dumbPaintTool.py"
}

30
apps/dumbPaintTool/main.py

@ -0,0 +1,30 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import sys,os
sys.path.append(os.path.join(sys.path[0],'../../'))
from dumbPaintTool.app import main
if __name__ == '__main__':
main()

10
apps/dumbPaintTool/web.ttk.package.json

@ -0,0 +1,10 @@
{
"libs" : [
{"pkg" :"bin/TermTk.tgz", "name": "TermTk"},
{"pkg" :"bin/DPT.tgz", "name": "Dumb Paint Tool"}
],
"pkgs" : [
"Pillow"
],
"main": "main.py"
}

2
tools/check.import.sh

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
__check(){ __check(){
grep -r -e "^import" -e "^from" TermTk | grep -r -e "^import" -e "^from" libs/pyTermTk/TermTk |
grep -v -e "from TermTk" -e "import TermTk" | grep -v -e "from TermTk" -e "import TermTk" |
grep -v "from typing import" | grep -v "from typing import" |
grep -v "__init__.py:from \.[^ ]* *import" | grep -v "__init__.py:from \.[^ ]* *import" |

20
tools/webExporterInit.sh

@ -43,8 +43,6 @@ echo Name: ${_NAME}
mkdir -p ${_TMP_PATH} mkdir -p ${_TMP_PATH}
rm -rf ${_TMP_PATH}/* itchExport.zip rm -rf ${_TMP_PATH}/* itchExport.zip
${_TOOLS_BASE_PATH}/prepareBuild.sh release
mkdir -p ${_TMP_PATH}/bin \ mkdir -p ${_TMP_PATH}/bin \
${_TMP_PATH}/www/pyodide \ ${_TMP_PATH}/www/pyodide \
${_TMP_PATH}/www/xterm/ \ ${_TMP_PATH}/www/xterm/ \
@ -62,7 +60,7 @@ function _download {
_F=$2 _F=$2
if [ -f tests/sandbox/${_F} ] ; if [ -f tests/sandbox/${_F} ] ;
then cp tests/sandbox/${_F} ${_P} ; then cp tests/sandbox/${_F} ${_P} ;
else wget -P ${_P} https://ceccopierangiolieugenio.github.io/binaryRepo/pyTermTk/${_F}; else wget -P ${_P} https://ceccopierangiolieugenio.github.io/pyTermTk-Docs/sandbox/${_F};
fi ; fi ;
}; };
@ -100,13 +98,15 @@ _download ${_TMP_PATH}/www/fonts/opentype/ www/fonts/opentype/3270-Regular.otf
_download ${_TMP_PATH}/www/ www/favicon.ico _download ${_TMP_PATH}/www/ www/favicon.ico
cd ${_BASE_PATH}/libs/pyTermTk/
tar cvzf ${_TMP_PATH}/bin/TermTk.tgz --exclude='__pycache__' --transform "s,^.*TermTk/,TermTk/," ${_TMP_PATH}/TermTk tar -cvzf ${_TMP_PATH}/bin/TermTk.tgz --exclude='__pycache__' TermTk
tar cvzf ${_TMP_PATH}/bin/DPT.tgz --exclude='__pycache__' --transform "s,^.*/dumbPaintTool,dumbPaintTool," \ cd ${_APPS_PATH}/dumbPaintTool
${_APPS_PATH}/dumbPaintTool.py \ tar -cvzf ${_TMP_PATH}/bin/DPT.tgz --exclude='__pycache__' \
${_APPS_PATH}/dumbPaintTool/*.py \ dumbPaintTool/*.py \
${_APPS_PATH}/dumbPaintTool/app \ dumbPaintTool/app \
${_APPS_PATH}/dumbPaintTool/tui dumbPaintTool/tui \
main.py
cd ${_BASE_PATH}
cp ${_APPS_PATH}/dumbPaintTool/web.ttk.package.json ${_TMP_PATH} cp ${_APPS_PATH}/dumbPaintTool/web.ttk.package.json ${_TMP_PATH}

Loading…
Cancel
Save