Skip to content

Commit

Permalink
add option 'update'
Browse files Browse the repository at this point in the history
  • Loading branch information
1138-4EB committed Oct 9, 2019
1 parent fc9c30b commit bbe7d5b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,23 @@ jobs:
with:
msystem: ${{ matrix.task }}
- run: msys2do ./test.sh

update:
strategy:
matrix:
task: [ MSYS, MINGW64, MINGW32 ]
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: build action
shell: bash
run: |
npm ci
npm run build
rm -rf node_modules
- name: run action
uses: ./
with:
update: True
msystem: ${{ matrix.task }}
- run: msys2do ./test.sh
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ The latest tarball available at [repo.msys2.org/distrib/x86_64](http://repo.msys
- run: msys2do uname -a
```
### Options
#### msystem
By default, `MSYSTEM` is set to `MINGW64`. However, an optional parameter named `msystem` is supported, which expects `MSYS`, `MINGW64` or `MING32`. For example:

```yaml
Expand All @@ -31,3 +35,13 @@ Furthermore, the environment variable can be overriden. This is useful when mult
set MSYSTEM=MINGW64
msys2do <command to test the package>
```

#### update

By default, the installation is not updated; hence package versions are those of the installation tarball. By setting option `update` to `true`, the action will execute `pacman -Syu --no-confirm`:

```yaml
- uses: numworks/setup-msys2@v1
with:
update: true
```
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ inputs:
description: 'Variant of the environment to set by default: MSYS, MINGW32 or MINGW64'
required: false
default: 'MINGW64'
update:
description: 'Update MSYS2 installation through pacman'
required: false
default: false
runs:
using: 'node12'
main: 'index.js'
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ async function run() {

core.startGroup('Starting MSYS2 for the first time...');
// For some reason, `msys2do` does not work
await exec.exec(`"${cmd}"`, ['uname', '-a']);
await exec.exec(`"${cmd}"`, (core.getInput('update') == 'true') ?
['pacman', '-Syu', '--noconfirm']
:
['uname', '-a']
);
core.endGroup();
}
catch (error) {
Expand Down

0 comments on commit bbe7d5b

Please sign in to comment.