mirror of
https://github.com/naveenrajm7/rpmbuild.git
synced 2025-07-12 04:13:50 +00:00
dowloaded archive into tar
This commit is contained in:
@ -16,27 +16,21 @@ function download_archive(owner, repo, ref) {
|
||||
try {
|
||||
const octokit = new Octokit();
|
||||
const archive_format = "tarball";
|
||||
const ref = "v1.0.0";
|
||||
const tag = "v1.0.0";
|
||||
const tarFile = `${tag}.tar.gz`;
|
||||
console.log("Calling API ...");
|
||||
octokit.repos.getBranch({
|
||||
octokit.repos.getArchiveLink({
|
||||
owner,
|
||||
repo,
|
||||
archive_format,
|
||||
ref
|
||||
}).then(({ data }) => {
|
||||
console.log(data);
|
||||
fs.writeFileSync(tarFile, Buffer.from(data));
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
// octokit.repos.getArchiveLink({
|
||||
// owner,
|
||||
// repo,
|
||||
// archive_format,
|
||||
// ref
|
||||
// }).then(( { data }) => {
|
||||
// console.log(data)
|
||||
// });
|
||||
//console.log(`Download Location : ${downloadLocation}`);
|
||||
//const tarBallPath = await tc.downloadTool(downloadLocation);
|
||||
//console.log(`Tarball Location : ${tarBallPath}`);
|
||||
//return tarBallPath;
|
||||
console.log(`Tarball Location : ${tarFile}`);
|
||||
return tarFile;
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
@ -28,16 +28,14 @@ function run() {
|
||||
console.log(`Hello ${specFile} from inside a container`);
|
||||
// Get repo files from /github/workspace/
|
||||
yield exec.exec('ls -la /github/workspace');
|
||||
// LOG: know current directory
|
||||
yield exec.exec('pwd && echo $HOME && ls');
|
||||
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
||||
//await io.cp('path/to/file', 'path/to/dest');
|
||||
yield io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/');
|
||||
// Get tar.gz file of release
|
||||
// 1. Write API call to download tar.gz from release OR
|
||||
// 2. Create tar.gz of /github/workspace to get tar of source code
|
||||
// Copy tar.gz file to /root/rpmbuild/SOURCES
|
||||
// make sure the name of tar.gz is same as given in Source of spec file
|
||||
//await io.cp('path/to/file', '/root/rpmbuild/SOURCES');
|
||||
yield io.cp(tarBallPath, '/root/rpmbuild/SOURCES');
|
||||
// Execute rpmbuild
|
||||
try {
|
||||
yield exec.exec(`rpmbuild -ba ${specFile}`);
|
||||
|
@ -9,35 +9,26 @@ async function download_archive(owner, repo, ref ) {
|
||||
const octokit = new Octokit();
|
||||
|
||||
const archive_format = "tarball";
|
||||
const ref = "v1.0.0"
|
||||
|
||||
const tag = "v1.0.0"
|
||||
|
||||
const tarFile = `${tag}.tar.gz`;
|
||||
|
||||
console.log("Calling API ...");
|
||||
|
||||
octokit.repos.getBranch({
|
||||
octokit.repos.getArchiveLink({
|
||||
owner,
|
||||
repo,
|
||||
archive_format,
|
||||
ref
|
||||
}).then(( { data }) => {
|
||||
console.log(data);
|
||||
});
|
||||
}).then(( { data }) => {
|
||||
fs.writeFileSync(tarFile, Buffer.from(data));
|
||||
}).catch( function(error){
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
console.log(`Tarball Location : ${tarFile}`);
|
||||
|
||||
// octokit.repos.getArchiveLink({
|
||||
// owner,
|
||||
// repo,
|
||||
// archive_format,
|
||||
// ref
|
||||
// }).then(( { data }) => {
|
||||
// console.log(data)
|
||||
// });
|
||||
|
||||
//console.log(`Download Location : ${downloadLocation}`);
|
||||
|
||||
//const tarBallPath = await tc.downloadTool(downloadLocation);
|
||||
|
||||
//console.log(`Tarball Location : ${tarBallPath}`);
|
||||
|
||||
//return tarBallPath;
|
||||
return tarFile;
|
||||
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
@ -26,11 +26,10 @@ async function run() {
|
||||
// Get repo files from /github/workspace/
|
||||
await exec.exec('ls -la /github/workspace');
|
||||
|
||||
// LOG: know current directory
|
||||
await exec.exec('pwd && echo $HOME && ls');
|
||||
|
||||
|
||||
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
||||
//await io.cp('path/to/file', 'path/to/dest');
|
||||
await io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/');
|
||||
|
||||
// Get tar.gz file of release
|
||||
// 1. Write API call to download tar.gz from release OR
|
||||
@ -38,7 +37,7 @@ async function run() {
|
||||
|
||||
// Copy tar.gz file to /root/rpmbuild/SOURCES
|
||||
// make sure the name of tar.gz is same as given in Source of spec file
|
||||
//await io.cp('path/to/file', '/root/rpmbuild/SOURCES');
|
||||
await io.cp(tarBallPath, '/root/rpmbuild/SOURCES');
|
||||
|
||||
// Execute rpmbuild
|
||||
try {
|
||||
|
Reference in New Issue
Block a user