Skip to content

Commit

Permalink
Add default branch workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanSiu1995 committed Aug 24, 2021
1 parent ff52bff commit 4765d4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
kubebuilder-version:
- 2.3.1
- 3.0.0
- master
kubebuilder-only:
- true
- false
Expand Down
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const child_process = require('child_process');

const supportedCombination = ["darwin-amd64", "linux-amd64", "linux-arm64", "linux-ppc64le"];
const installedBinary = ["kubectl", "kube-apiserver", "kubebuilder", "etcd"];
const defaultBranch = ["master", "main"];

function execSync(command) {
child_process.execSync(command, {shell: '/bin/bash'});
Expand All @@ -18,7 +19,9 @@ async function run() {
const kubebuilderOnly = core.getInput('kubebuilderOnly') === 'true';
let etcdVersion = core.getInput('etcdVersion');
let kubernetesVersion = core.getInput('kubernetesVersion');
const majorVersion = version.split(".")[0];
if (!defaultBranch.includes(version)) {
const majorVersion = version.split(".")[0];
}

if (kubebuilderOnly && etcdVersion) {
core.warning("kubebuilderOnly is activated. etcdVersion will not be respected.");
Expand Down Expand Up @@ -48,9 +51,7 @@ async function run() {

core.info(`Going to install kubebuilder ${version} for ${osPlat}-${osArch}`);



if (majorVersion > 2) {
if (defaultBranch.includes(version) || majorVersion > 2) {
core.debug(`MajorVersion is greater than 2`);
const downloadUrl = `https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/kubebuilder_${osPlat}_${osArch}`;
execSync(`sudo mkdir -p /usr/local/kubebuilder/bin`);
Expand Down

0 comments on commit 4765d4c

Please sign in to comment.