version is a must for source

This commit is contained in:
Naveenraj M
2020-03-30 03:41:19 +05:30
parent ae6201f9c5
commit 1ff3b59df3
2 changed files with 11 additions and 8 deletions

View File

@ -21,6 +21,7 @@ function run() {
const owner = context.repo.owner; const owner = context.repo.owner;
const repo = context.repo.repo; const repo = context.repo.repo;
const ref = context.ref; const ref = context.ref;
const version = "1.0.0";
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`);
@ -29,12 +30,12 @@ function run() {
// 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/${specFile}`, '/github/home/rpmbuild/SPECS/'); yield io.cp(`/github/workspace/${specFile}`, '/github/home/rpmbuild/SPECS/');
yield exec.exec(`curl -L --output tmp.tar.gz https://api.github.com/repos/${owner}/${repo}/tarball/${ref}`); yield exec.exec(`curl -L --output tmp.tar.gz https://api.github.com/repos/${owner}/${repo}/tarball/${ref}`);
yield exec.exec(`mkdir ${repo}`); yield exec.exec(`mkdir ${repo}-${version}`);
yield exec.exec(`tar xvf tmp.tar.gz -C ${repo} --strip-components 1`); yield exec.exec(`tar xvf tmp.tar.gz -C ${repo}-${version} --strip-components 1`);
yield exec.exec(`tar -czvf ${repo}.tar.gz ${repo}`); yield exec.exec(`tar -czvf ${repo}-${version}.tar.gz ${repo}-${version}`);
// Get repo files from /github/workspace/ // Get repo files from /github/workspace/
yield exec.exec('ls -la '); yield exec.exec('ls -la ');
yield exec.exec(`cp ${repo}.tar.gz /github/home/rpmbuild/SOURCES/`); yield exec.exec(`cp ${repo}-${version}.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');

View File

@ -14,6 +14,8 @@ async function run() {
const repo = context.repo.repo const repo = context.repo.repo
const ref = context.ref const ref = context.ref
const version = "1.0.0"
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');
@ -27,15 +29,15 @@ async function run() {
await exec.exec(`curl -L --output tmp.tar.gz https://api.github.com/repos/${owner}/${repo}/tarball/${ref}`) await exec.exec(`curl -L --output tmp.tar.gz https://api.github.com/repos/${owner}/${repo}/tarball/${ref}`)
await exec.exec(`mkdir ${repo}`); await exec.exec(`mkdir ${repo}-${version}`);
await exec.exec(`tar xvf tmp.tar.gz -C ${repo} --strip-components 1`); await exec.exec(`tar xvf tmp.tar.gz -C ${repo}-${version} --strip-components 1`);
await exec.exec(`tar -czvf ${repo}.tar.gz ${repo}`); await exec.exec(`tar -czvf ${repo}-${version}.tar.gz ${repo}-${version}`);
// Get repo files from /github/workspace/ // Get repo files from /github/workspace/
await exec.exec('ls -la '); await exec.exec('ls -la ');
await exec.exec(`cp ${repo}.tar.gz /github/home/rpmbuild/SOURCES/`); await exec.exec(`cp ${repo}-${version}.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