mirror of
https://github.com/naveenrajm7/rpmbuild.git
synced 2025-07-12 20:23:50 +00:00
HOME is /github/home/
This commit is contained in:
13
lib/main.js
13
lib/main.js
@ -24,14 +24,15 @@ function run() {
|
|||||||
console.log(`We can even get context data, like the owner: ${owner}, repo: ${repo}, ref: ${ref}`);
|
console.log(`We can even get context data, like the owner: ${owner}, repo: ${repo}, ref: ${ref}`);
|
||||||
const specFile = core.getInput('specFile');
|
const specFile = core.getInput('specFile');
|
||||||
console.log(`Hello ${specFile} from inside a container`);
|
console.log(`Hello ${specFile} from inside a container`);
|
||||||
|
yield exec.exec('rpmdev-setuptree');
|
||||||
// Get repo files from /github/workspace/
|
// Get repo files from /github/workspace/
|
||||||
yield exec.exec('ls -la ');
|
yield exec.exec('ls -la ');
|
||||||
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
||||||
yield io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/');
|
yield io.cp('/github/workspace/cello.spec', '/github/home/rpmbuild/SPECS/');
|
||||||
// Get tar.gz file of release
|
// Get tar.gz file of release
|
||||||
yield download_tar(owner, repo, ref).then(function (filePath) {
|
yield download_tar(owner, repo, ref).then(function (filePath) {
|
||||||
console.log(`Tar Path for copy : ${filePath}`);
|
console.log(`Tar Path for copy : ${filePath}`);
|
||||||
io.cp(`${repo}-1.0.tar.gz`, '/root/rpmbuild/SOURCES/');
|
io.cp(`${repo}-1.0.tar.gz`, '/github/home/rpmbuild/SOURCES/');
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
@ -39,25 +40,25 @@ function run() {
|
|||||||
yield exec.exec('echo "$HOME"');
|
yield exec.exec('echo "$HOME"');
|
||||||
// Get repo files from /github/workspace/
|
// Get repo files from /github/workspace/
|
||||||
yield exec.exec('ls -la ');
|
yield exec.exec('ls -la ');
|
||||||
yield io.cp(`${repo}-1.0.tar.gz`, '/root/rpmbuild/SOURCES/');
|
yield io.cp(`${repo}-1.0.tar.gz`, '/github/home/rpmbuild/SOURCES/');
|
||||||
// Copy tar.gz file to /root/rpmbuild/SOURCES
|
// Copy tar.gz file to /root/rpmbuild/SOURCES
|
||||||
// make sure the name of tar.gz is same as given in Source of spec file
|
// make sure the name of tar.gz is same as given in Source of spec file
|
||||||
//await io.cp(tarBallPath, '/root/rpmbuild/SOURCES');
|
//await io.cp(tarBallPath, '/root/rpmbuild/SOURCES');
|
||||||
// Execute rpmbuild
|
// Execute rpmbuild
|
||||||
try {
|
try {
|
||||||
yield exec.exec(`rpmbuild --define '_topdir /root/rpmbuild' -ba /github/workspace/cello.spec`);
|
yield exec.exec(`rpmbuild --define -ba /github/home/rpmbuild/SPECS/cello.spec`);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.setFailed(`action failed with error: ${err}`);
|
core.setFailed(`action failed with error: ${err}`);
|
||||||
}
|
}
|
||||||
// Get path for rpm
|
// Get path for rpm
|
||||||
//const rpmPath = await exec.exec('node', ['index.js', 'foo=bar'], options);
|
//const rpmPath = await exec.exec('node', ['index.js', 'foo=bar'], options);
|
||||||
yield exec.exec('ls /root/rpmbuild/RPMS');
|
yield exec.exec('ls /github/home/rpmbuild/RPMS');
|
||||||
// setOutput rpm_path to /root/rpmbuild/RPMS , to be consumed by other actions like
|
// setOutput rpm_path to /root/rpmbuild/RPMS , to be consumed by other actions like
|
||||||
// actions/upload-release-asset
|
// actions/upload-release-asset
|
||||||
// If you want to upload yourself , need to write api call to upload as asset
|
// If you want to upload yourself , need to write api call to upload as asset
|
||||||
//core.setOutput("rpmPath", rpmPath)
|
//core.setOutput("rpmPath", rpmPath)
|
||||||
core.setOutput("source_rpm_path", "/root/rpmbuild/SRPMS"); // make option to upload source rpm
|
core.setOutput("source_rpm_path", "/github/home/rpmbuild/SRPMS"); // make option to upload source rpm
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
14
src/main.ts
14
src/main.ts
@ -19,11 +19,13 @@ async function run() {
|
|||||||
const specFile = core.getInput('specFile');
|
const specFile = core.getInput('specFile');
|
||||||
console.log(`Hello ${specFile} from inside a container`);
|
console.log(`Hello ${specFile} from inside a container`);
|
||||||
|
|
||||||
|
await exec.exec('rpmdev-setuptree');
|
||||||
|
|
||||||
// Get repo files from /github/workspace/
|
// Get repo files from /github/workspace/
|
||||||
await exec.exec('ls -la ');
|
await exec.exec('ls -la ');
|
||||||
|
|
||||||
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
||||||
await io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/');
|
await io.cp('/github/workspace/cello.spec', '/github/home/rpmbuild/SPECS/');
|
||||||
|
|
||||||
// Get tar.gz file of release
|
// Get tar.gz file of release
|
||||||
await download_tar(
|
await download_tar(
|
||||||
@ -32,7 +34,7 @@ async function run() {
|
|||||||
ref
|
ref
|
||||||
).then( function(filePath){
|
).then( function(filePath){
|
||||||
console.log(`Tar Path for copy : ${filePath}`);
|
console.log(`Tar Path for copy : ${filePath}`);
|
||||||
io.cp(`${repo}-1.0.tar.gz`, '/root/rpmbuild/SOURCES/');
|
io.cp(`${repo}-1.0.tar.gz`, '/github/home/rpmbuild/SOURCES/');
|
||||||
}).catch(function(error){
|
}).catch(function(error){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
@ -42,7 +44,7 @@ async function run() {
|
|||||||
|
|
||||||
// Get repo files from /github/workspace/
|
// Get repo files from /github/workspace/
|
||||||
await exec.exec('ls -la ');
|
await exec.exec('ls -la ');
|
||||||
await io.cp(`${repo}-1.0.tar.gz`, '/root/rpmbuild/SOURCES/');
|
await io.cp(`${repo}-1.0.tar.gz`, '/github/home/rpmbuild/SOURCES/');
|
||||||
|
|
||||||
// Copy tar.gz file to /root/rpmbuild/SOURCES
|
// Copy tar.gz file to /root/rpmbuild/SOURCES
|
||||||
// make sure the name of tar.gz is same as given in Source of spec file
|
// make sure the name of tar.gz is same as given in Source of spec file
|
||||||
@ -51,7 +53,7 @@ async function run() {
|
|||||||
// Execute rpmbuild
|
// Execute rpmbuild
|
||||||
try {
|
try {
|
||||||
await exec.exec(
|
await exec.exec(
|
||||||
`rpmbuild --define '_topdir /root/rpmbuild' -ba /github/workspace/cello.spec`
|
`rpmbuild --define -ba /github/home/rpmbuild/SPECS/cello.spec`
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.setFailed(`action failed with error: ${err}`);
|
core.setFailed(`action failed with error: ${err}`);
|
||||||
@ -59,13 +61,13 @@ async function run() {
|
|||||||
|
|
||||||
// Get path for rpm
|
// Get path for rpm
|
||||||
//const rpmPath = await exec.exec('node', ['index.js', 'foo=bar'], options);
|
//const rpmPath = await exec.exec('node', ['index.js', 'foo=bar'], options);
|
||||||
await exec.exec('ls /root/rpmbuild/RPMS');
|
await exec.exec('ls /github/home/rpmbuild/RPMS');
|
||||||
|
|
||||||
// setOutput rpm_path to /root/rpmbuild/RPMS , to be consumed by other actions like
|
// setOutput rpm_path to /root/rpmbuild/RPMS , to be consumed by other actions like
|
||||||
// actions/upload-release-asset
|
// actions/upload-release-asset
|
||||||
// If you want to upload yourself , need to write api call to upload as asset
|
// If you want to upload yourself , need to write api call to upload as asset
|
||||||
//core.setOutput("rpmPath", rpmPath)
|
//core.setOutput("rpmPath", rpmPath)
|
||||||
core.setOutput("source_rpm_path", "/root/rpmbuild/SRPMS") // make option to upload source rpm
|
core.setOutput("source_rpm_path", "/github/home/rpmbuild/SRPMS") // make option to upload source rpm
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
Reference in New Issue
Block a user