From a437e12afd62f4893538586882537fa2167897b0 Mon Sep 17 00:00:00 2001 From: Thiago Silva Date: Mon, 16 May 2022 13:31:00 -0300 Subject: [PATCH] Changes the repo to be passed as argument --- .github/workflows/live_artifacts.yml | 6 ++++-- ci/build-centos.sh | 3 ++- util/makesrc | 8 +++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/live_artifacts.yml b/.github/workflows/live_artifacts.yml index 633b216e..de1fc72f 100644 --- a/.github/workflows/live_artifacts.yml +++ b/.github/workflows/live_artifacts.yml @@ -70,9 +70,10 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 90 steps: - - name: Checkout the Tag + - name: Sets the tag and repo variables (to build) run: | echo "TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV + echo "REPO_TO_BUILD=${{ github.event.inputs.repo }}" >> $GITHUB_ENV - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f with: submodules: "recursive" @@ -84,7 +85,8 @@ jobs: run: | mkdir -p ${GITHUB_WORKSPACE}/artifacts docker run -e LIVE=1 -e PAT=${{ secrets.GITHUB_TOKEN }} \ - -e TAG=$TAG -v ${GITHUB_WORKSPACE}:/workspace \ + -e TAG=$TAG -e REPO_TO_BUILD=$REPO_TO_BUILD + -v ${GITHUB_WORKSPACE}:/workspace \ -v ${GITHUB_WORKSPACE}/artifacts:/root/rpmbuild \ nanocurrency/nano-env:centos /bin/bash -c "ci/build-centos.sh" - name: Deploy Artifacts diff --git a/ci/build-centos.sh b/ci/build-centos.sh index 6f9c7cf4..39157c31 100755 --- a/ci/build-centos.sh +++ b/ci/build-centos.sh @@ -2,9 +2,10 @@ TAG=$(echo $TAG) VERSIONS=${TAG//V/} RELEASE=$(echo $CI_JOB_ID) +REPO_TO_BUILD=$(echo $REPO_TO_BUILD) run_source() { - ./util/makesrc $TAG $(echo $PAT) + ./util/makesrc $TAG $(echo $PAT) $REPO_TO_BUILD } run_build() { diff --git a/util/makesrc b/util/makesrc index ca0a32aa..a4e22ce8 100755 --- a/util/makesrc +++ b/util/makesrc @@ -4,21 +4,23 @@ # personal access token allows around rate limit if [ -e $2 ]; then - echo "makesrc " >&2 - echo " tag valid for nanocurrency/nano-node" >&2 + echo "makesrc " >&2 + echo " tag valid for " >&2 echo " pat personal access token" >&2 + echo " repo repository to build" >&2 exit 1 fi TAG="$1" PAT="$2" +repository="${3:-nanocurrency/nano-node}" VERSION=$(echo $TAG | sed 's/V//') TAG_DATE="" VERSION_MAJOR=$(echo $VERSION | cut -d "." -f 1) scriptDir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" function make_source() { - git clone --recursive --single-branch --branch ${TAG} https://github.com/nanocurrency/nano-node nano-$VERSION + git clone --recursive --single-branch --branch "${TAG}" "https://github.com/${repository}" "nano-${VERSION}" cd nano-$VERSION git fetch --tags COUNT=$(git tag -l "${TAG}" | wc -l)