Skip to content

Release All Integrations without JEC scripts #1

Release All Integrations without JEC scripts

Release All Integrations without JEC scripts #1

name: Release All Integrations without JEC scripts
on:
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
outputs:
integrations: ${{ steps.gather_params.outputs.INTEGRATIONS }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Retrieve Integration Version
id: gather_params
run: |
echo ::set-output name=INTEGRATIONS::$(jq -r 'keys' release/integration-builder/version.json)
release-integrations:
needs: [ setup ]
strategy:
matrix:
integration: ${{ fromJson(needs.setup.outputs.integrations) }}
uses: ./.github/workflows/release-without-jec.yml
with:
integration: ${{ matrix.integration }}
update-versions:
name: Update versions
runs-on: ubuntu-latest
needs: [ setup ]
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout the repository with branch
uses: actions/checkout@v4
- name: Set branch name to env
id: prepare-branch-name
run: |
branchName=release-all-non-jec-$(date +%s)
echo branchName:$branchName
echo ::set-output name=BRANCH_NAME::$(echo $branchName)
- name: Commit and push changes
env:
GH_TOKEN: ${{ github.token }}
BRANCH_NAME: ${{ steps.prepare-branch-name.outputs.branch_name }}
run: |
BRANCH_NAME=${{ env.BRANCH_NAME }}
version_file="release/integration-builder/version.json"
git config --global user.name 'Github Actions'
git config --global user.email '[email protected]'
git checkout "$BRANCH_NAME" 2>/dev/null || git checkout -b "$BRANCH_NAME"
pr_body=$'Update all non-jec integrations\' versions\n'
inc_ver() {
local INTEGRATION_NAME=$1
current_version=$(jq -r --arg integration "$INTEGRATION_NAME" '.[$integration]' "$version_file")
new_version=$(echo "$current_version" | awk -F. -v OFS=. '{$3++;print}')
echo "Updating $INTEGRATION_NAME version from $current_version to $new_version in $version_file"
jq --arg new_version "$new_version" --arg integration "$INTEGRATION_NAME" '.[$integration] = $new_version' "$version_file" >temp.json && mv temp.json "$version_file"
pr_body+=$'\n- Update '$INTEGRATION_NAME$' version from '$current_version$' to '$new_version
}
while read -r key; do
inc_ver "$key"
done < <(jq -r 'keys' "$version_file" | jq -r '.[]')
git commit -am "Update version file after release(s)"
git push origin "$BRANCH_NAME"
gh pr create --title "Update all non-jec integrations' versions" \
--body "$pr_body" \
--base master \
--head $BRANCH_NAME \
--reviewer ${{ github.actor }}