mirror of
https://github.com/naveenrajm7/rpmbuild.git
synced 2025-07-12 12:13:51 +00:00
calling download function
This commit is contained in:
20
src/main.ts
20
src/main.ts
@ -2,13 +2,23 @@ const core = require('@actions/core');
|
|||||||
const github = require('@actions/github');
|
const github = require('@actions/github');
|
||||||
const exec = require('@actions/exec');
|
const exec = require('@actions/exec');
|
||||||
const io = require('@actions/io');
|
const io = require('@actions/io');
|
||||||
|
const download_tar = require('./download-release-archive');
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Get github context data
|
// Get github context data
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
console.log(`We can even get context data, like the repo: ${context.repo.repo}`);
|
|
||||||
|
const owner = context.repo.owner
|
||||||
|
const repo = context.repo.repo
|
||||||
|
const ref = context.repo.ref
|
||||||
|
|
||||||
|
console.log(`We can even get context data, like the owner: ${owner}, repo: ${repo}, ref: ${ref}`);
|
||||||
|
|
||||||
|
const tarBallPath = download_tar(owner, repo, ref);
|
||||||
|
|
||||||
|
console.log(`Tar Path for copy : ${tarBallPath}`);
|
||||||
|
|
||||||
const specFile = core.getInput('specFile');
|
const specFile = core.getInput('specFile');
|
||||||
core.debug(`Hello ${specFile} from inside a container`);
|
core.debug(`Hello ${specFile} from inside a container`);
|
||||||
@ -20,7 +30,7 @@ async function run() {
|
|||||||
await exec.exec('pwd && echo $HOME && ls');
|
await exec.exec('pwd && echo $HOME && ls');
|
||||||
|
|
||||||
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
// Copy spec file from path specFile to /root/rpmbuild/SPECS/
|
||||||
await io.cp('path/to/file', 'path/to/dest');
|
//await io.cp('path/to/file', 'path/to/dest');
|
||||||
|
|
||||||
// Get tar.gz file of release
|
// Get tar.gz file of release
|
||||||
// 1. Write API call to download tar.gz from release OR
|
// 1. Write API call to download tar.gz from release OR
|
||||||
@ -28,7 +38,7 @@ async function run() {
|
|||||||
|
|
||||||
// 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('path/to/file', '/root/rpmbuild/SOURCES');
|
//await io.cp('path/to/file', '/root/rpmbuild/SOURCES');
|
||||||
|
|
||||||
// Execute rpmbuild
|
// Execute rpmbuild
|
||||||
try {
|
try {
|
||||||
@ -45,8 +55,8 @@ async function run() {
|
|||||||
// 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("sourceRpmPath", sourceRpmPath) // make option to upload source rpm
|
//core.setOutput("sourceRpmPath", sourceRpmPath) // make option to upload source rpm
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user