Skip to content

Commit 3836105

Browse files
committed
add option 'install'
1 parent a115d3f commit 3836105

File tree

3 files changed

+46
-7
lines changed

3 files changed

+46
-7
lines changed

.github/workflows/test.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ jobs:
123123
update:
124124
strategy:
125125
fail-fast: false
126+
max-parallel: 3
126127
matrix:
127-
task: [ MSYS, MINGW64, MINGW32 ]
128+
msystem: [ MSYS, MINGW64, MINGW32 ]
128129
runs-on: windows-latest
129130
steps:
130131
- uses: actions/checkout@v1
@@ -137,9 +138,9 @@ jobs:
137138
- name: run action
138139
uses: ./
139140
with:
140-
update: True
141-
msystem: ${{ matrix.task }}
142-
- run: msys2do ./test.sh ${{ matrix.task }}
141+
update: true
142+
msystem: ${{ matrix.msystem }}
143+
- run: msys2do ./test.sh ${{ matrix.msystem }}
143144

144145
MSYS2_PATH_TYPE:
145146
runs-on: windows-latest
@@ -174,3 +175,26 @@ jobs:
174175
with:
175176
path-type: inherit
176177
- run: msys2do go env
178+
179+
install:
180+
strategy:
181+
fail-fast: false
182+
max-parallel: 3
183+
matrix:
184+
install: [ false, git, 'base-devel git' ]
185+
runs-on: windows-latest
186+
steps:
187+
- uses: actions/checkout@v1
188+
- name: build action
189+
shell: bash
190+
run: |
191+
npm ci
192+
npm run pkg
193+
rm -rf node_modules
194+
- name: run action
195+
uses: ./
196+
with:
197+
update: true
198+
install: ${{ matrix.install }}
199+
msystem: MINGW64
200+
- run: msys2do ./test.sh MINGW64

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ inputs:
1313
description: 'Update MSYS2 installation through pacman'
1414
required: false
1515
default: false
16+
install:
17+
description: 'Install packages after installation through pacman'
18+
required: false
19+
default: false
1620
runs:
1721
using: 'node12'
1822
main: 'index.js'

main.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,34 @@ async function run() {
4545

4646
core.exportVariable('MSYSTEM', core.getInput('msystem'));
4747

48+
async function pacman(args) {
49+
await exec.exec('cmd', ['/D', '/S', '/C', cmd, 'pacman', '--noconfirm'].concat(args));
50+
}
51+
4852
core.startGroup('Starting MSYS2 for the first time...');
4953
if (core.getInput('update') == 'true') {
50-
await exec.exec('cmd', ['/D', '/S', '/C', cmd].concat(['pacman', '-Sy', '--noconfirm']));
54+
await pacman(['-Sy']);
5155
core.endGroup();
5256
core.startGroup('Updating bash and pacman...');
53-
await exec.exec('cmd', ['/D', '/S', '/C', cmd].concat(['pacman', '--needed', '-S', 'bash', 'pacman', '--noconfirm']));
57+
await pacman(['--needed', '-S', 'bash', 'pacman'])
5458
core.endGroup();
5559
core.startGroup('Killing remaining tasks...');
5660
await exec.exec('taskkill', ['/IM', 'gpg-agent.exe', '/F']);
5761
await exec.exec('taskkill', ['/IM', 'dirmngr.exe', '/F']);
5862
core.endGroup();
5963
core.startGroup('Updating packages...');
60-
await exec.exec('cmd', ['/D', '/S', '/C', cmd].concat(['pacman', '-Suu', '--noconfirm']));
64+
await pacman(['-Suu']);
6165
} else {
6266
await exec.exec('cmd', ['/D', '/S', '/C', cmd].concat(['uname', '-a']));
6367
}
6468
core.endGroup();
69+
70+
let install = core.getInput('install');
71+
if (install != '' && install != 'false') {
72+
core.startGroup('Installing additional packages...');
73+
await pacman(['-S'].concat(install.split(' ')));
74+
core.endGroup();
75+
}
6576
}
6677
catch (error) {
6778
core.setFailed(error.message);

0 commit comments

Comments
 (0)