Merge pull request #18 from StCyr/fix_17

Supports new user input: 'additional_repos'
This commit is contained in:
Naveenraj M
2022-11-10 18:59:17 -07:00
committed by GitHub
3 changed files with 16 additions and 1 deletions

View File

@ -14,6 +14,7 @@ Create a workflow `.yml` file in your repositories `.github/workflows` directory
### Inputs ### Inputs
- `spec_file`: The path to the spec file in your repo. [**required**] - `spec_file`: The path to the spec file in your repo. [**required**]
- `additional_repos`: A list of additional repositories (in JSON-array format) that you want enabled to build your rpm. [**optional**]
### Outputs ### Outputs
@ -47,6 +48,7 @@ jobs:
uses: naveenrajm7/rpmbuild@master uses: naveenrajm7/rpmbuild@master
with: with:
spec_file: "cello.spec" spec_file: "cello.spec"
additional_repos: "['centos-release-scl', 'http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm']"
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v1.0.0 uses: actions/upload-artifact@v1.0.0

View File

@ -7,6 +7,9 @@ inputs:
description: 'path to the spec file' description: 'path to the spec file'
required: true required: true
default: '*.spec' #Any spec file in top default: '*.spec' #Any spec file in top
additional_repos:
description: 'A list of additional repositories to enable'
required: false
outputs: outputs:
source_rpm_path: source_rpm_path:

View File

@ -56,8 +56,18 @@ async function run() {
await exec.exec(`ln -s /github/home/rpmbuild/SOURCES/${name}-${version}.tar.gz /github/home/rpmbuild/SOURCES/${name}.tar.gz`); await exec.exec(`ln -s /github/home/rpmbuild/SOURCES/${name}-${version}.tar.gz /github/home/rpmbuild/SOURCES/${name}.tar.gz`);
process.env.GIT_DIR = oldGitDir; process.env.GIT_DIR = oldGitDir;
// Installs additional repositories
const additionalRepos = core.getInput('additional_repos'); // user input, eg: '["centos-release-scl"]'
if (additionalRepos) {
const arr = JSON.parse(additionalRepos);
for (let i = 0; i < arr.length; i++) {
console.log(`Installing repo': ${arr[i]}`);
await exec.exec(`yum install -y ${arr[i]}`);
};
}
// Installs build dependencies // Installs build dependencies
await exec.exec(`yum-builddep ${specFile.destFullPath}`); await exec.exec(`yum-builddep -y ${specFile.destFullPath}`);
// Execute rpmbuild , -ba generates both RPMS and SPRMS // Execute rpmbuild , -ba generates both RPMS and SPRMS
try { try {