Skip to content

Commit

Permalink
fix path for powershell
Browse files Browse the repository at this point in the history
  • Loading branch information
boozook committed Jun 27, 2024
1 parent c2a9e80 commit 8983b2b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
44 changes: 39 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ Also installs arm-gcc gnu toolchain.
- `custom-url` - Custom URL to the SDK installer. Useful for beta versions. If set, `version` will be ignored.
- `gcc` - `true` to install `gcc-arm-none-eabi` toolchain, `false` to don't. Default is `true`.
(Linux & Windows only. On macOS, the sdk installer installs the toolchain itself.)
- `root-win-path` - `true` to convert path to windows path format. _Only for win- workers._
It changes `outputs.root`, but not `$PLAYDATE_SDK_PATH`.


## Supported platforms

- macOS
- Linux
- Windows


## Usage Example
Expand All @@ -23,7 +32,7 @@ Also installs arm-gcc gnu toolchain.
id: playdate
uses: pd-rs/[email protected]
with:
version: 2.4.2 # possible values: version `x.x.x` or `latest` by default
version: 2.5.0 # possible values: version `x.x.x` or `latest` by default

- name: usage
run: |
Expand All @@ -33,8 +42,33 @@ Also installs arm-gcc gnu toolchain.
pdc --version # because SDK/bin already in PATH
```
## Supported platforms
- macOS
- Linux
- Windows
### Windows and Powershell
Note that `$PLAYDATE_SDK_PATH` and `outputs.root` are set in POSIX format.
If you want to use it in powershell you should fix it using one of following solutions:
1. enable `root-win-path` _(see [inputs](#parameters))_
1. fix the env for powershell from bash with:
```yaml
- if: runner.os == 'Windows'
shell: bash
run: |
PLAYDATE_SDK_PATH=$(cygpath -w "$PLAYDATE_SDK_PATH")
echo "PLAYDATE_SDK_PATH=$PLAYDATE_SDK_PATH" >> $GITHUB_ENV
```
So you'll get fixed `$PLAYDATE_SDK_PATH` for powershell and normal `outputs.root` in POSIX
1. enable `root-win-path` _(see [inputs](#parameters))_ __and__ fix the env for powershell from bash with:
```yaml
- name: Install Playdate SDK
id: playdate
uses: pd-rs/[email protected]
with:
root-win-path: true
- run: echo "PLAYDATE_SDK_PATH=$PLAYDATE_SDK_PATH" >> $GITHUB_ENV
env: PLAYDATE_SDK_PATH: ${{ steps.playdate.outputs.root }}
if: runner.os == 'Windows'
shell: bash
```
So you'll get both paths fixed for powershell - `$PLAYDATE_SDK_PATH` and `outputs.root`.
11 changes: 11 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ inputs:
default: "true"
description: Install gcc-arm-none-eabi toolchain
required: false
root-win-path:
default: "false"
description: Convert path to windows path format. Ignored on non-win workers. If enabled changes `outputs.root`, but not `$PLAYDATE_SDK_PATH`.
required: false
# path:
# default: default
# description: SDK installation path. Optional.
Expand Down Expand Up @@ -153,3 +157,10 @@ runs:
run: |
echo "root=$PLAYDATE_SDK_PATH" >> $GITHUB_OUTPUT
echo "version=$(cat $PLAYDATE_SDK_PATH/VERSION.txt)" >> $GITHUB_OUTPUT
- name: fix output
shell: bash
if: runner.os == 'Windows' && inputs.root-win-path != 'false'
run: |
PLAYDATE_SDK_PATH=$(cygpath -w "$PLAYDATE_SDK_PATH")
echo "root=$PLAYDATE_SDK_PATH" >> $GITHUB_OUTPUT

0 comments on commit 8983b2b

Please sign in to comment.