diff --git a/.github/bin/make-branch.sh b/.github/bin/make-branch.sh deleted file mode 100755 index 4963148..0000000 --- a/.github/bin/make-branch.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -xe -# Release process automation script. -# Used to create a branch -BASEBRANCH=main -FORCENEWBRANCH=0 # unless forced, don't create a new branch if one already exists. Use with caution! -REPO=git@github.com:eclipse/che-jwtproxy.git - -while [[ "$#" -gt 0 ]]; do - case $1 in - '-b'|'--branch') BRANCH="$2"; shift 1;; - '-bf'|'--branchfrom') BASEBRANCH="$2"; shift 1;; - '--force') FORCENEWBRANCH=1; shift 0;; - esac - shift 1 -done - -usage () -{ - echo "Usage: $0 --branch [new branch to create] --branchfrom [source branch]" - echo "Example: $0 --branch 7.25.x --branchfrom $BASEBRANCH" - echo - echo "Use --force to delete + recreate an existing branch." - echo -} - -if [[ ! ${BRANCH} ]]; then - usage - exit 1 -fi - -# create new branch off ${BASEBRANCH} (recreate only if --force'd) -if [[ "${BASEBRANCH}" != "${BRANCH}" ]]; then - git fetch - git branch -D "${BRANCH}" || true - git checkout "${BASEBRANCH}" || true - # if branch exists and FORCENEWBRANCH true, delete from remote before creating new branch - if [[ $(git ls-remote --heads ${REPO} "refs/heads/${BRANCH}" || true) != "" ]] && [[ ${FORCENEWBRANCH} -eq 1 ]]; then - git push origin ":${BRANCH}" - fi - git branch "${BRANCH}" - git push origin "${BRANCH}" -fi diff --git a/.github/workflows/make-branch.yaml b/.github/workflows/make-branch.yaml index 0fc436b..1213e7b 100644 --- a/.github/workflows/make-branch.yaml +++ b/.github/workflows/make-branch.yaml @@ -1,3 +1,4 @@ + name: Create branch on: # to be run once every 3 weeks for a 7.yy.0 release, so we can get a stable 7.yy.x branch for use by downstream consumers @@ -8,7 +9,7 @@ on: required: true branchfrom: description: 'The source branch from which to branch, eg., main' - default: 'master' + default: 'main' forceflag: description: 'To force creation of .x branch, use --force flag here' default: '' @@ -24,5 +25,8 @@ jobs: run: | git config --global user.name "Mykhailo Kuznietsov" git config --global user.email "mkuznets@redhat.com" - export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - .github/bin/make-branch.sh --branch ${{ github.event.inputs.branch }} --branchfrom ${{ github.event.inputs.branchfrom }} ${{ github.event.inputs.forceflag }} + curl https://raw.githubusercontent.com/eclipse-che/che-release/main/make-branch.sh | bash -s -- \ + --branch ${{ github.event.inputs.branch }} \ + --branchfrom ${{ github.event.inputs.branchfrom }} \ + --repo "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \ + ${{ github.event.inputs.forceflag }} \ No newline at end of file