Skip to content

Commit a5189d0

Browse files
committed
WIP
1 parent 00213bd commit a5189d0

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

dist/index.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35979,6 +35979,8 @@ var __webpack_exports__ = {};
3597935979
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(9896);
3598035980
/* harmony import */ var yaml__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(8815);
3598135981
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(7484);
35982+
/* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(5236);
35983+
3598235984

3598335985

3598435986

@@ -35988,7 +35990,9 @@ function run() {
3598835990
getRubyVersion('dev.yml')
3598935991
_actions_core__WEBPACK_IMPORTED_MODULE_2__.endGroup()
3599035992

35991-
// setupDependencies()
35993+
_actions_core__WEBPACK_IMPORTED_MODULE_2__.startGroup('Setting up Linux dependencies')
35994+
setupDependencies('tmp/.shopify-build/**/*.yml')
35995+
_actions_core__WEBPACK_IMPORTED_MODULE_2__.endGroup()
3599235996
}
3599335997

3599435998
function getRubyVersion(path) {
@@ -36027,12 +36031,12 @@ function setupDependencies(glob) {
3602736031
let aptRepos = []
3602836032

3602936033
fs__WEBPACK_IMPORTED_MODULE_0__.globSync(glob).forEach(file => {
36030-
pipeline = yaml__WEBPACK_IMPORTED_MODULE_1__.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(file, 'utf8'))
36031-
containers = pipeline.containers
36034+
let pipeline = yaml__WEBPACK_IMPORTED_MODULE_1__.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(file, 'utf8'))
36035+
let containers = pipeline.containers
3603236036
if (!containers) { return }
3603336037

3603436038
Object.values(containers).forEach(container => {
36035-
apt = container.build?.apt
36039+
let apt = container.build?.apt
3603636040
if (!apt) { return }
3603736041

3603836042
aptKeys.push(...apt.keys || [])
@@ -36043,7 +36047,16 @@ function setupDependencies(glob) {
3604336047

3604436048
if (aptPackages.length == 0) { return }
3604536049

36046-
// aptKeys.forEach(key => )
36050+
aptKeys.forEach(key => {
36051+
_actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec(`curl -s ${key} | sudo apt-key add -`)
36052+
})
36053+
36054+
aptRepos.forEach(repo => {
36055+
_actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec(`sudo sh -c echo ${repo} >> /etc/apt/sources.list.d/custom.list`)
36056+
})
36057+
36058+
_actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec('sudo apt-get update')
36059+
_actions_exec__WEBPACK_IMPORTED_MODULE_3__.exec(`sudo apt-get install --yes --option DPkg::Lock::Timeout=60 ${aptPackages.join(' ')}`)
3604736060
}
3604836061

3604936062
var __webpack_exports__getRubyVersion = __webpack_exports__.hg;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"homepage": "https://github.com/shopify-playground/edouard-github-action#readme",
2222
"dependencies": {
2323
"@actions/core": "^1.11.1",
24+
"@actions/exec": "^1.1.1",
2425
"@actions/github": "^6.0.1",
2526
"yaml": "^2.8.1"
2627
},

src/index.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import fs from 'fs'
22
import YAML from 'yaml'
33
import core from '@actions/core'
4+
import exec from '@actions/exec'
45

56
export function run() {
67
core.startGroup('Gettng the Ruby version')
78
getRubyVersion('dev.yml')
89
core.endGroup()
910

10-
// setupDependencies()
11+
core.startGroup('Setting up Linux dependencies')
12+
setupDependencies('tmp/.shopify-build/**/*.yml')
13+
core.endGroup()
1114
}
1215

1316
export function getRubyVersion(path) {
@@ -46,12 +49,12 @@ export function setupDependencies(glob) {
4649
let aptRepos = []
4750

4851
fs.globSync(glob).forEach(file => {
49-
pipeline = YAML.parse(fs.readFileSync(file, 'utf8'))
50-
containers = pipeline.containers
52+
let pipeline = YAML.parse(fs.readFileSync(file, 'utf8'))
53+
let containers = pipeline.containers
5154
if (!containers) { return }
5255

5356
Object.values(containers).forEach(container => {
54-
apt = container.build?.apt
57+
let apt = container.build?.apt
5558
if (!apt) { return }
5659

5760
aptKeys.push(...apt.keys || [])
@@ -62,5 +65,14 @@ export function setupDependencies(glob) {
6265

6366
if (aptPackages.length == 0) { return }
6467

65-
// aptKeys.forEach(key => )
68+
aptKeys.forEach(key => {
69+
exec.exec(`curl -s ${key} | sudo apt-key add -`)
70+
})
71+
72+
aptRepos.forEach(repo => {
73+
exec.exec(`sudo sh -c echo ${repo} >> /etc/apt/sources.list.d/custom.list`)
74+
})
75+
76+
exec.exec('sudo apt-get update')
77+
exec.exec(`sudo apt-get install --yes --option DPkg::Lock::Timeout=60 ${aptPackages.join(' ')}`)
6678
}

0 commit comments

Comments
 (0)