Skip to content

Commit

Permalink
Specify spec file
Browse files Browse the repository at this point in the history
  • Loading branch information
JackMcKew committed Aug 11, 2020
1 parent 1592857 commit 302a20f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Github Action for building executables with PyInstaller

To build your application, you need to specify where your source code is via the `path` argument, this defaults to `src`.

The source code directory should have your `.spec` file that PyInstaller generates. If you don't have one, you'll need to run PyInstaller once locally to generate it.
The source code directory should have your `.spec` file that PyInstaller generates. If you don't have one, you'll need to run PyInstaller once locally to generate it. Also if you have another program `.spec` file you can set specific pyinstaller `.spec` file by `spec: <YOUR_SPEC_FILE_NAME>`

If the `src` folder has a `requirements.txt` file, the packages will be installed into the environment before PyInstaller runs.

Expand Down
27 changes: 16 additions & 11 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
# action.yaml
name: 'PyInstaller Linux'
description: 'Customisable GitHub Action to package your python code with PyInstaller for Linux'
name: "PyInstaller Linux"
description: "Customisable GitHub Action to package your python code with PyInstaller for Linux"
branding:
icon: 'box'
color: 'blue'
icon: "box"
color: "blue"
inputs:
path:
description: 'Directory containing source code & .spec file (optional requirements.txt).'
description: "Directory containing source code & .spec file (optional requirements.txt)."
required: True
default: src
pypi_url:
description: 'Specify a custom URL for PYPI'
description: "Specify a custom URL for PYPI"
required: False
default: https://pypi.python.org/
pypi_index_url:
description: 'Specify a custom URL for PYPI Index'
description: "Specify a custom URL for PYPI Index"
required: False
default: https://pypi.python.org/simple
spec:
description: "Specify a file path for .spec file"
required: False
default: ""
outputs:
output:
description: 'The output of PyInstaller'
description: "The output of PyInstaller"

runs:
using: 'docker'
image: 'Dockerfile'
using: "docker"
image: "Dockerfile"
args:
- ${{ inputs.path }}
- ${{ inputs.pypi_url }}
- ${{ inputs.pypi_index_url }}
- ${{ inputs.pypi_index_url }}
- ${{ inputs.spec }}
8 changes: 5 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ PYPI_INDEX_URL=$3

WORKDIR=${SRCDIR:-/src}

SPEC_FILE=${4:-*.spec}

/root/.pyenv/shims/python -m pip install --upgrade pip wheel setuptools

#
# In case the user specified a custom URL for PYPI, then use
# that one, instead of the default one.
Expand All @@ -41,8 +45,6 @@ if [ -f requirements.txt ]; then
/root/.pyenv/shims/pip install -r requirements.txt
fi # [ -f requirements.txt ]

echo "Installed"

/root/.pyenv/shims/pyinstaller --clean -y --dist ./dist/linux --workpath /tmp *.spec
/root/.pyenv/shims/pyinstaller --clean -y --dist ./dist/linux --workpath /tmp $SPEC_FILE

chown -R --reference=. ./dist/linux

0 comments on commit 302a20f

Please sign in to comment.