Skip to content

Commit

Permalink
Consume ORG from env, if available
Browse files Browse the repository at this point in the history
Make sure to consume it if available, simplifying and streamlining
releasing.

Signed-off-by: Mike Kolesnik <[email protected]>
  • Loading branch information
mkolesnik authored and tpantelis committed Sep 8, 2022
1 parent 6c85344 commit 5e5a409
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions scripts/lib/utils
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ readonly PROJECTS_PROJECTS=(cloud-prepare lighthouse submariner)
readonly INSTALLER_PROJECTS=(submariner-charts submariner-operator)
readonly RELEASED_PROJECTS=(subctl)

echo "GITHUB_REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER}" >&2
ORG=${GITHUB_REPOSITORY_OWNER:-$(git config --get remote.origin.url | awk -F'[:/]' '{print $(NF-1)}')}
ORG=${ORG:-${GITHUB_REPOSITORY_OWNER:-$(git config --get remote.origin.url | awk -F'[:/]' '{print $(NF-1)}')}}
declare -A NEXT_STATUS=( [branch]=shipyard [shipyard]=admiral [admiral]=projects [projects]=installers [installers]=released )

function printerr() {
Expand Down
8 changes: 5 additions & 3 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
set -e
set -o pipefail

export ORG="${ORG:-submariner-io}"

source "${DAPPER_SOURCE}/scripts/lib/utils"
source "${SCRIPTS_DIR}/lib/utils"
print_env ORG GITHUB_ACTOR GITHUB_REPOSITORY_OWNER
source "${SCRIPTS_DIR}/lib/debug_functions"

ORG=submariner-io

### Functions: General ###

function expect_env() {
Expand Down Expand Up @@ -93,7 +95,7 @@ function create_pr() {

# shellcheck disable=SC2046
project="$(basename $(pwd))"
local repo="submariner-io/${project}"
local repo="${ORG}/${project}"
local gh_user=${GITHUB_ACTOR:-${ORG}}

git add "${file}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/test/entire-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# Always run on "main" org and not on forks that can be stale
export GITHUB_REPOSITORY_OWNER=submariner-io
export ORG=submariner-io

source "${DAPPER_SOURCE}/scripts/lib/utils"
source "${DAPPER_SOURCE}/scripts/test/utils"
Expand Down
2 changes: 1 addition & 1 deletion scripts/test/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# Always run on "main" org and not on forks that can be stale
export GITHUB_REPOSITORY_OWNER=submariner-io
export ORG=submariner-io

source "${DAPPER_SOURCE}/scripts/lib/utils"
source "${DAPPER_SOURCE}/scripts/test/utils"
Expand Down

0 comments on commit 5e5a409

Please sign in to comment.