start use pr number instead of branch name for custom deployments (#2179)

Co-authored-by: Azat Safin <azsafin@provectus.com>
This commit is contained in:
azatsafin 2022-06-17 15:20:41 +03:00 committed by GitHub
parent d565ad4e38
commit d0e1e2bf6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 11 deletions

View file

@ -13,11 +13,7 @@ jobs:
- name: get branch name
id: extract_branch
run: |
hub pr checkout ${{ github.event.pull_request.number }}
branch_name=$(hub branch | grep "*" | sed -e 's/^\*//')
echo $branch_name
echo ::set-output name=branch::${branch_name}
tag=$(echo $branch_name | sed 's/\//-/g' | sed 's/\./-/g' | sed 's/\_/-/g' | sed -e 's/\(.*\)/\L\1/' | cut -c1-32 | sed -E 's/(^[^a-z0-9])*([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)([^a-z0-9]*)/\2/')
tag='pr${{ github.event.pull_request.number }}'
echo ::set-output name=tag::${tag}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -12,11 +12,7 @@ jobs:
- name: get branch name
id: extract_branch
run: |
hub pr checkout ${{ github.event.pull_request.number }}
branch_name=$(hub branch | grep "*" | sed -e 's/^\*//')
echo $branch_name
echo ::set-output name=branch::${branch_name}
tag=$(echo $branch_name | sed 's/\//-/g' | sed 's/\./-/g' | sed 's/\_/-/g' | cut -c1-32)
tag='pr${{ github.event.pull_request.number }}'
echo ::set-output name=tag::${tag}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -27,7 +23,7 @@ jobs:
run: |
cd kafka-ui-infra/aws-infrastructure4eks/argocd/scripts
echo "Branch:${{ steps.extract_branch.outputs.tag }}"
./delete-env.sh ${{ steps.extract_branch.outputs.tag }}
./delete-env.sh ${{ steps.extract_branch.outputs.tag }} || true
git config --global user.email "kafka-ui-infra@provectus.com"
git config --global user.name "kafka-ui-infra"
git add ../kafka-ui-from-branch/