Skip to content

Commit

Permalink
add 'msys.cmd' to support multi-line run steps
Browse files Browse the repository at this point in the history
  • Loading branch information
1138-4EB authored and eine committed Jan 19, 2020
1 parent 29532be commit 610484b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ jobs:
env:
MSYSTEM: MINGW32

shell:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: install deps
run: npm ci
- name: run action
uses: ./
- shell: msys2 {0}
run: |
uname -a
pacman -Syu --noconfirm
msystem:
strategy:
matrix:
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@

**setup-msys2** is a JavaScript GitHub Action (GHA) to setup a full-featured [MSYS2](https://www.msys2.org/) environment, using the GHA [toolkit](https://github.com/actions/toolkit).

The latest tarball available at [repo.msys2.org/distrib/x86_64](http://repo.msys2.org/distrib/x86_64/) is cached. Using the action extracts it and provides an entrypoint named `msys2do`.
The latest tarball available at [repo.msys2.org/distrib/x86_64](http://repo.msys2.org/distrib/x86_64/) is cached. Using the action extracts it and provides two entrypoints named `msys2` and `msys2do`.

## Usage

```yaml
- uses: numworks/setup-msys2@v1
- shell: msys2 {0}
run: uname -a
```
```yaml
- uses: numworks/setup-msys2@v1
- run: msys2do uname -a
Expand All @@ -35,8 +41,10 @@ Furthermore, the environment variable can be overriden. This is useful when mult
- uses: numworks/setup-msys2@v1
with:
msystem: MSYS
- run: msys2do makepkg-mingw -sCLfc --noconfirm --noprogressbar
- run: msys2do pacman --noconfirm -U mingw-w64-*-any.pkg.tar.xz
- shell: msys2
run: |
makepkg-mingw -sCLfc --noconfirm --noprogressbar
pacman --noconfirm -U mingw-w64-*-any.pkg.tar.xz
- run: |
set MSYSTEM=MINGW64
msys2do <command to test the package>
Expand Down
14 changes: 11 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,20 @@ async function run() {

let cmd = path.join(dest, 'msys2do.cmd');
fs.writeFileSync(cmd, [
'setlocal',
'@echo off',
'IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=' + core.getInput('path-type'),
`setlocal`,
`@echo off`,
`IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=` + core.getInput('path-type'),
`%~dp0\\msys64\\usr\\bin\\bash.exe -ilc "cd $OLDPWD && %*"`
].join('\r\n'));

fs.writeFileSync(path.join(dest, 'msys2.cmd'), [
`setlocal`,
`@echo off`,
`set "args=%*"`,
`set "args=%args:\\=/%"`,
cmd + ` %args%`
].join('\r\n'));

core.addPath(dest);

core.exportVariable('MSYSTEM', core.getInput('msystem'));
Expand Down

0 comments on commit 610484b

Please sign in to comment.