From 610484bde241155b419ef4f2887eb59c0a3db72c Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Wed, 23 Oct 2019 04:01:28 +0200 Subject: [PATCH] add 'msys.cmd' to support multi-line run steps --- .github/workflows/test.yml | 13 +++++++++++++ README.md | 14 +++++++++++--- index.js | 14 +++++++++++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 551656b..9c329a3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: diff --git a/README.md b/README.md index b035c49..ac9fca1 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/index.js b/index.js index 697846c..b717923 100644 --- a/index.js +++ b/index.js @@ -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'));