From 29890d78996c0fc3237284ca8b62d38cf8c08394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Ara=C3=BAjo=20Gomes?= Date: Fri, 25 Oct 2024 12:52:16 +0100 Subject: [PATCH] update kics internal release workflow --- .github/workflows/release-kics-cxone.yaml | 44 ++++++++++++++++++ .../release-kics-queries-repo-branch.yaml | 45 ------------------- 2 files changed, 44 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/release-kics-cxone.yaml delete mode 100644 .github/workflows/release-kics-queries-repo-branch.yaml diff --git a/.github/workflows/release-kics-cxone.yaml b/.github/workflows/release-kics-cxone.yaml new file mode 100644 index 00000000000..ed5f559835f --- /dev/null +++ b/.github/workflows/release-kics-cxone.yaml @@ -0,0 +1,44 @@ +name: release-kics-cxone +on: + release: + types: + - published +jobs: + create-branch: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Set up Git credentials + run: | + git config --global user.name "KICSBot" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global url."https://${{ secrets.CHECKMARXDEV_GIT_TOKEN }}@github.com".insteadOf "https://github.com" + + - name: Clone internal repository + run: | + cd .. + git clone https://github.com/CheckmarxDev/${{ secrets.CHECKMARXDEV_KICS_RELEASER }}.git + + - name: Create new branch for release ${{ github.event.release.name }} + run: | + cd ../${{ secrets.CHECKMARXDEV_KICS_RELEASER }} + git checkout --orphan ${{ github.event.release.name }} + find . -mindepth 1 \( -not -path './.*' -not -name 'README.md' -o -name '.gitignore' \) -delete + + - name: Copy queries to new branch + run: | + mkdir -p ../${{ secrets.CHECKMARXDEV_KICS_RELEASER }}/kics-queries + rsync -av --exclude='*/test/*' --exclude='common/*' ./assets/queries/ ../${{ secrets.CHECKMARXDEV_KICS_RELEASER }}/kics-queries/ + + - name: Modify circleci configuration + run: | + sed -i 's/BRANCH_NAME_TEMPLATE_TO_REPLACE/${{ github.event.release.name }}/g' ../${{ secrets.CHECKMARXDEV_KICS_RELEASER }}/.circleci/config.yml + + - name: Push branch + run: | + cd ../${{ secrets.CHECKMARXDEV_KICS_RELEASER }} + git add . + git commit -m "AUTO: Add queries from release ${{ github.event.release.name }} to ${{ secrets.CHECKMARXDEV_KICS_RELEASER }}" + git push origin ${{ github.event.release.name }} \ No newline at end of file diff --git a/.github/workflows/release-kics-queries-repo-branch.yaml b/.github/workflows/release-kics-queries-repo-branch.yaml deleted file mode 100644 index 07a11e75d71..00000000000 --- a/.github/workflows/release-kics-queries-repo-branch.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: release-kics-queries-repo-branch -on: - release: - types: - - published -jobs: - create-branch: - runs-on: ubuntu-latest - env: - REPO_NAME: "kics-queries-repo" - steps: - - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Set up Git credentials - run: | - git config --global user.name "KICSBot" - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --global url."https://${{ secrets.CHECKMARXDEV_GIT_TOKEN }}@github.com".insteadOf "https://github.com" - - - name: Clone kics-queries-repo from CheckmarxDev - run: | - cd .. - git clone https://github.com/CheckmarxDev/$REPO_NAME.git - - - name: Create new branch for release ${{ github.event.release.name }} - run: | - cd ../$REPO_NAME - git checkout -b ${{ github.event.release.name }} - - - name: Copy queries to new branch - run: | - mkdir -p ../$REPO_NAME/kics-queries - rsync -av --exclude='*/test/*' --exclude='common/*' ./assets/queries/ ../$REPO_NAME/kics-queries/ - - - name: Modify circleci configuration - run: | - sed -i 's/branch_name_template_to_replace/${{ github.event.release.name }}/g' ../$REPO_NAME/.circleci/config.yml - - - name: Push branch - run: | - cd ../$REPO_NAME - git add . - git commit -m "Add queries from release ${{ github.event.release.name }} to $REPO_NAME" - git push origin ${{ github.event.release.name }}