Skip to content

Commit

Permalink
feat: Add custom installation directory
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeSavefrogs committed May 18, 2023
1 parent ef44ff4 commit b0e861c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
This action provides the following functionality for GitHub Actions users:

- Installing a version of Jython and adding it to `PATH`
- Customizing the installation path

## Basic usage

Expand All @@ -16,6 +17,7 @@ steps:
uses: LukeSavefrogs/setup-jython@v1
with:
jython-version: '2.5.2'
installation-path: '~/jython/' # Default

- run: jython -c 'import sys, os; print(os.name, sys.version)';
```
Expand Down
15 changes: 11 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ inputs:
jython-version:
description: 'The version of Jython to use'
required: true
default: '2.7.2'
default: "2.7.2"

installation-path:
description: 'The path where Jython will be installed'
required: false
default: "~/jython/"

outputs:
jython-download-url:
Expand Down Expand Up @@ -76,18 +81,20 @@ runs:
# This is why I use the standard installation
# java -jar /tmp/jython_installer.jar \
# --silent \
# --directory ~/jython/ \
# --directory ${{ inputs.installation-path }} \
# --type standalone;
java -jar /tmp/jython_installer.jar \
--silent \
--directory ~/jython/ \
--directory ${{ inputs.installation-path }} \
--type standard;
- name: Setup Jython alias
shell: bash
run: |
installation_path="$(sed -r 's/^\s+//; s/\s+$//; ' <<< "${{ inputs.installation-path }}")"
mkdir -p ~/.local/bin;
echo 'java -jar ~/jython/jython.jar "$@"' >> ~/.local/bin/jython;
echo 'java -jar ${installation_path}/jython.jar "$@"' >> ~/.local/bin/jython;
chmod +x ~/.local/bin/jython;
echo ~/.local/bin >> $GITHUB_PATH

0 comments on commit b0e861c

Please sign in to comment.