Skip to content

Commit b0e861c

Browse files
committed
feat: Add custom installation directory
1 parent ef44ff4 commit b0e861c

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
This action provides the following functionality for GitHub Actions users:
66

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

910
## Basic usage
1011

@@ -16,6 +17,7 @@ steps:
1617
uses: LukeSavefrogs/setup-jython@v1
1718
with:
1819
jython-version: '2.5.2'
20+
installation-path: '~/jython/' # Default
1921

2022
- run: jython -c 'import sys, os; print(os.name, sys.version)';
2123
```

action.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ inputs:
55
jython-version:
66
description: 'The version of Jython to use'
77
required: true
8-
default: '2.7.2'
8+
default: "2.7.2"
9+
10+
installation-path:
11+
description: 'The path where Jython will be installed'
12+
required: false
13+
default: "~/jython/"
914

1015
outputs:
1116
jython-download-url:
@@ -76,18 +81,20 @@ runs:
7681
# This is why I use the standard installation
7782
# java -jar /tmp/jython_installer.jar \
7883
# --silent \
79-
# --directory ~/jython/ \
84+
# --directory ${{ inputs.installation-path }} \
8085
# --type standalone;
8186
8287
java -jar /tmp/jython_installer.jar \
8388
--silent \
84-
--directory ~/jython/ \
89+
--directory ${{ inputs.installation-path }} \
8590
--type standard;
8691
8792
- name: Setup Jython alias
8893
shell: bash
8994
run: |
95+
installation_path="$(sed -r 's/^\s+//; s/\s+$//; ' <<< "${{ inputs.installation-path }}")"
96+
9097
mkdir -p ~/.local/bin;
91-
echo 'java -jar ~/jython/jython.jar "$@"' >> ~/.local/bin/jython;
98+
echo 'java -jar ${installation_path}/jython.jar "$@"' >> ~/.local/bin/jython;
9299
chmod +x ~/.local/bin/jython;
93100
echo ~/.local/bin >> $GITHUB_PATH

0 commit comments

Comments
 (0)