From 2cee81d97c920afd781893a3b92ef6d2a924323e Mon Sep 17 00:00:00 2001 From: Ravi Kumar Pilla Date: Mon, 14 Aug 2023 23:50:46 -0500 Subject: [PATCH] Automating Release process (#1) * v6.3.6 * Revert "v6.3.6" This reverts commit 5ffe696beaa156cfb384a62a6201056d9a8d431c. * v6.3.5 * testing release workflow-1 * testing release workflow-1 * testing release workflow-1 --- .circleci/config.yml | 42 +- .circleci/continue_config.yml | 770 +++++++++--------- .github/workflows/check-release.yml | 107 +++ RELEASE.md | 9 + demo-project/.version | 2 +- demo-project/lightsail.json | 2 +- package-lock.json | 2 +- package.json | 2 +- package/kedro_viz/__init__.py | 2 +- tools/github_actions/check_version.py | 45 + tools/github_actions/extract_release_notes.py | 40 + 11 files changed, 612 insertions(+), 411 deletions(-) create mode 100644 .github/workflows/check-release.yml create mode 100644 tools/github_actions/check_version.py create mode 100644 tools/github_actions/extract_release_notes.py diff --git a/.circleci/config.yml b/.circleci/config.yml index e39a7fc479..ccc9e7548b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,24 +1,24 @@ -version: 2.1 +# version: 2.1 -setup: true +# setup: true -orbs: - path-filtering: circleci/path-filtering@0.1.1 +# orbs: +# path-filtering: circleci/path-filtering@0.1.1 -workflows: - regular: - jobs: - # the path-filtering/filter job determines which pipeline - # parameters to update, i.e. which builds to run. - - path-filtering/filter: - name: check-updated-files - base-revision: main - config-path: .circleci/continue_config.yml - # - mapping: | - package/.* backend_change true - .circleci/.* ci_change true - ^((?!package/).)*$ frontend_change true - filters: - tags: - only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ +# workflows: +# regular: +# jobs: +# # the path-filtering/filter job determines which pipeline +# # parameters to update, i.e. which builds to run. +# - path-filtering/filter: +# name: check-updated-files +# base-revision: main +# config-path: .circleci/continue_config.yml +# # +# mapping: | +# package/.* backend_change true +# .circleci/.* ci_change true +# ^((?!package/).)*$ frontend_change true +# filters: +# tags: +# only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ diff --git a/.circleci/continue_config.yml b/.circleci/continue_config.yml index cc1f7a5285..7d05cb54a3 100644 --- a/.circleci/continue_config.yml +++ b/.circleci/continue_config.yml @@ -1,413 +1,413 @@ -version: 2.1 +# version: 2.1 -# Backend CI jobs are the heavy ones, so we only run them if the backend -# or CI config has changed. -parameters: - backend_change: - type: boolean - default: false - ci_change: - type: boolean - default: false - frontend_change: - type: boolean - default: false +# # Backend CI jobs are the heavy ones, so we only run them if the backend +# # or CI config has changed. +# parameters: +# backend_change: +# type: boolean +# default: false +# ci_change: +# type: boolean +# default: false +# frontend_change: +# type: boolean +# default: false -orbs: - win: circleci/windows@2.4.1 - node: circleci/node@5.0.3 +# orbs: +# win: circleci/windows@2.4.1 +# node: circleci/node@5.0.3 -# No windows executor is listed here since windows builds use win/default and modify -# the Python version through the conda environment. -executors: - docker: - parameters: - python_version: - type: string - docker: - - image: cimg/python:<>-node - working_directory: ~/repo +# # No windows executor is listed here since windows builds use win/default and modify +# # the Python version through the conda environment. +# executors: +# docker: +# parameters: +# python_version: +# type: string +# docker: +# - image: cimg/python:<>-node +# working_directory: ~/repo -commands: - setup_python_env: - steps: - - run: - name: Install Python dependencies - command: | - pip install git+https://github.com/kedro-org/kedro@main - pip install -r package/test_requirements.txt -r demo-project/src/docker_requirements.txt -U - - run: - name: Echo package versions - command: | - python -V - pip freeze +# commands: +# setup_python_env: +# steps: +# - run: +# name: Install Python dependencies +# command: | +# pip install git+https://github.com/kedro-org/kedro@main +# pip install -r package/test_requirements.txt -r demo-project/src/docker_requirements.txt -U +# - run: +# name: Echo package versions +# command: | +# python -V +# pip freeze - install_node_dependencies: - steps: - - node/install: - node-version: '16.13.2' - # using install-packages command from node orb - - node/install-packages +# install_node_dependencies: +# steps: +# - node/install: +# node-version: '16.13.2' +# # using install-packages command from node orb +# - node/install-packages - nvm_use_npm_install: - steps: - - run: - name: Use NVM to run Node v16 - command: | - nvm install v16.13.2 - node -v - nvm alias default v16.13.2 - nvm use v16.13.2 - - run: - name: Install Node dependencies - command: | - node -v - npm install +# nvm_use_npm_install: +# steps: +# - run: +# name: Use NVM to run Node v16 +# command: | +# nvm install v16.13.2 +# node -v +# nvm alias default v16.13.2 +# nvm use v16.13.2 +# - run: +# name: Install Node dependencies +# command: | +# node -v +# npm install - npm_build: - steps: - - run: - name: Build React application - command: | - node -v - make build +# npm_build: +# steps: +# - run: +# name: Build React application +# command: | +# node -v +# make build - win_setup_python_env: - # Miniconda3 is pre-installed on the machine: - # https://circleci.com/docs/2.0/hello-world-windows/ - parameters: - python_version: - type: string - steps: - - run: - name: Initialize conda - command: conda init powershell - - run: - name: Create 'kedro-viz' conda environment - command: conda create --name kedro-viz python=<> -y - - run: - name: Install Kedro-Viz dependencies - command: | - conda activate kedro-viz - pip install git+https://github.com/kedro-org/kedro@main - pip install -r package/test_requirements.txt -U - - run: - name: Echo package versions - command: | - conda activate kedro-viz - python -V - pip freeze - - run: - name: Install 'make' command - command: choco install make +# win_setup_python_env: +# # Miniconda3 is pre-installed on the machine: +# # https://circleci.com/docs/2.0/hello-world-windows/ +# parameters: +# python_version: +# type: string +# steps: +# - run: +# name: Initialize conda +# command: conda init powershell +# - run: +# name: Create 'kedro-viz' conda environment +# command: conda create --name kedro-viz python=<> -y +# - run: +# name: Install Kedro-Viz dependencies +# command: | +# conda activate kedro-viz +# pip install git+https://github.com/kedro-org/kedro@main +# pip install -r package/test_requirements.txt -U +# - run: +# name: Echo package versions +# command: | +# conda activate kedro-viz +# python -V +# pip freeze +# - run: +# name: Install 'make' command +# command: choco install make - setup: - steps: - - checkout - - setup_python_env - - install_node_dependencies - - npm_build +# setup: +# steps: +# - checkout +# - setup_python_env +# - install_node_dependencies +# - npm_build - win_setup: - parameters: - python_version: - type: string - executor: - steps: - - checkout - - win_setup_python_env: - python_version: <> - - nvm_use_npm_install - - npm_build +# win_setup: +# parameters: +# python_version: +# type: string +# executor: +# steps: +# - checkout +# - win_setup_python_env: +# python_version: <> +# - nvm_use_npm_install +# - npm_build - setup_cypress_requirements: - description: Install cypress requirements and dependencies - steps: - - run: - name: Install cypress system dependencies - command: | - sudo sed -i 's/archive.ubuntu.com/us-east-1.ec2.archive.ubuntu.com/g' /etc/apt/sources.list - sudo apt-get update - sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb +# setup_cypress_requirements: +# description: Install cypress requirements and dependencies +# steps: +# - run: +# name: Install cypress system dependencies +# command: | +# sudo sed -i 's/archive.ubuntu.com/us-east-1.ec2.archive.ubuntu.com/g' /etc/apt/sources.list +# sudo apt-get update +# sudo apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb -jobs: - e2e_tests: - parameters: - python_version: - type: string - executor: - name: docker - python_version: <> - steps: - - setup - - run: - name: Run all end to end tests - command: make e2e-tests +# jobs: +# e2e_tests: +# parameters: +# python_version: +# type: string +# executor: +# name: docker +# python_version: <> +# steps: +# - setup +# - run: +# name: Run all end to end tests +# command: make e2e-tests - win_e2e_tests: - parameters: - python_version: - type: string - executor: win/default - steps: - - win_setup: - python_version: <> - - run: - name: Run all end to end tests on Windows - command: conda activate kedro-viz; make e2e-tests +# win_e2e_tests: +# parameters: +# python_version: +# type: string +# executor: win/default +# steps: +# - win_setup: +# python_version: <> +# - run: +# name: Run all end to end tests on Windows +# command: conda activate kedro-viz; make e2e-tests - unit_tests: - parameters: - python_version: - type: string - executor: - name: docker - python_version: <> - steps: - - setup - - run: - name: Run Python tests - command: make pytest +# unit_tests: +# parameters: +# python_version: +# type: string +# executor: +# name: docker +# python_version: <> +# steps: +# - setup +# - run: +# name: Run Python tests +# command: make pytest - win_unit_tests: - parameters: - python_version: - type: string - executor: win/default - steps: - - win_setup: - python_version: <> - - run: - name: Run Python tests on Windows - command: conda activate kedro-viz; make pytest +# win_unit_tests: +# parameters: +# python_version: +# type: string +# executor: win/default +# steps: +# - win_setup: +# python_version: <> +# - run: +# name: Run Python tests on Windows +# command: conda activate kedro-viz; make pytest - lint: - parameters: - python_version: - type: string - executor: - name: docker - python_version: <> - steps: - - checkout - - setup_python_env - - run: - name: Run secret scan - command: make secret-scan - - run: - name: Run security scan - command: make security-scan - - run: - name: Verify GraphQL schema is up to date - command: make schema-check - - run: - name: Run Python formatters and linters - command: make format-check lint-check +# lint: +# parameters: +# python_version: +# type: string +# executor: +# name: docker +# python_version: <> +# steps: +# - checkout +# - setup_python_env +# - run: +# name: Run secret scan +# command: make secret-scan +# - run: +# name: Run security scan +# command: make security-scan +# - run: +# name: Verify GraphQL schema is up to date +# command: make schema-check +# - run: +# name: Run Python formatters and linters +# command: make format-check lint-check - javascript_lint_and_tests: - executor: - name: docker - python_version: '3.8' - steps: - - checkout - - setup_python_env - - install_node_dependencies - - setup_cypress_requirements - - run: - name: Test lib transpilation - command: npm run lib - - run: - name: Test JS library imports - command: | - npm run lib-test:setup - cd tools/test-lib/react-app - npm run test:ci - - run: - name: Run Eslint - command: npm run lint - - run: - name: Run JavaScript tests - command: npm run build:css && npm run test:ci - - run: - name: Run Javascript end to end tests - command: npm run cy:ci +# javascript_lint_and_tests: +# executor: +# name: docker +# python_version: '3.8' +# steps: +# - checkout +# - setup_python_env +# - install_node_dependencies +# - setup_cypress_requirements +# - run: +# name: Test lib transpilation +# command: npm run lib +# - run: +# name: Test JS library imports +# command: | +# npm run lib-test:setup +# cd tools/test-lib/react-app +# npm run test:ci +# - run: +# name: Run Eslint +# command: npm run lint +# - run: +# name: Run JavaScript tests +# command: npm run build:css && npm run test:ci +# - run: +# name: Run Javascript end to end tests +# command: npm run cy:ci - release_to_npm: - executor: - name: docker - python_version: '3.8' - steps: - - checkout - - install_node_dependencies - - npm_build - - run: - name: Authenticate with registry - command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc - - run: - name: Publish to npm - command: npm publish +# release_to_npm: +# executor: +# name: docker +# python_version: '3.8' +# steps: +# - checkout +# - install_node_dependencies +# - npm_build +# - run: +# name: Authenticate with registry +# command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc +# - run: +# name: Publish to npm +# command: npm publish - release_to_pypi: - executor: - name: docker - python_version: '3.8' - steps: - - setup - - run: - name: Make Python package - command: make package - - run: - name: Install twine - command: python -m pip install -U twine - - run: - name: Publish to PyPI - command: python -m twine upload package/dist/* +# release_to_pypi: +# executor: +# name: docker +# python_version: '3.8' +# steps: +# - setup +# - run: +# name: Make Python package +# command: make package +# - run: +# name: Install twine +# command: python -m pip install -U twine +# - run: +# name: Publish to PyPI +# command: python -m twine upload package/dist/* - deploy_demo: - executor: - name: docker - python_version: '3.8' - steps: - - checkout - - setup_remote_docker - - run: - name: Setup environment - command: | - cd demo-project - echo "AWS_ECR_URL=public.ecr.aws/g0x0s3o2/kedro-viz-live-demo" >> $BASH_ENV - echo "KEDRO_VIZ_VERSION=$(cat .version)" >> $BASH_ENV - echo "cd demo-project" >> $BASH_ENV - - run: - name: Install AWS CLI - command: pip3 install awscli - - run: - name: Build demo container image - command: | - echo "kedro_viz==$KEDRO_VIZ_VERSION" >> src/docker_requirements.txt - docker build -t $AWS_ECR_URL:$KEDRO_VIZ_VERSION . - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws - docker push $AWS_ECR_URL:$KEDRO_VIZ_VERSION - - run: - name: Create a new lightsail deployment - command: | - # install lightsail cli - # run https://docs.aws.amazon.com/cli/latest/reference/lightsail/create-container-service-deployment.html#create-container-service-deployment - aws lightsail create-container-service-deployment --region eu-west-2 --cli-input-json file://./lightsail.json +# deploy_demo: +# executor: +# name: docker +# python_version: '3.8' +# steps: +# - checkout +# - setup_remote_docker +# - run: +# name: Setup environment +# command: | +# cd demo-project +# echo "AWS_ECR_URL=public.ecr.aws/g0x0s3o2/kedro-viz-live-demo" >> $BASH_ENV +# echo "KEDRO_VIZ_VERSION=$(cat .version)" >> $BASH_ENV +# echo "cd demo-project" >> $BASH_ENV +# - run: +# name: Install AWS CLI +# command: pip3 install awscli +# - run: +# name: Build demo container image +# command: | +# echo "kedro_viz==$KEDRO_VIZ_VERSION" >> src/docker_requirements.txt +# docker build -t $AWS_ECR_URL:$KEDRO_VIZ_VERSION . +# aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws +# docker push $AWS_ECR_URL:$KEDRO_VIZ_VERSION +# - run: +# name: Create a new lightsail deployment +# command: | +# # install lightsail cli +# # run https://docs.aws.amazon.com/cli/latest/reference/lightsail/create-container-service-deployment.html#create-container-service-deployment +# aws lightsail create-container-service-deployment --region eu-west-2 --cli-input-json file://./lightsail.json - all_circleci_checks_succeeded: - docker: - - image: circleci/python # any light-weight image - steps: - - run: - name: Success! - command: echo "All checks passed" +# all_circleci_checks_succeeded: +# docker: +# - image: circleci/python # any light-weight image +# steps: +# - run: +# name: Success! +# command: echo "All checks passed" -release_filter: &release_filter - filters: - tags: - only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ - branches: - ignore: /.*/ +# release_filter: &release_filter +# filters: +# tags: +# only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ +# branches: +# ignore: /.*/ -workflows: - version: 2.1 +# workflows: +# version: 2.1 - deploy_demo: - jobs: - - deploy_demo: - context: - - kedro-ecr-publish - filters: - branches: - only: demo +# deploy_demo: +# jobs: +# - deploy_demo: +# context: +# - kedro-ecr-publish +# filters: +# branches: +# only: demo - build_frontend: - when: - or: - - <> - - <> - jobs: - - javascript_lint_and_tests - - all_circleci_checks_succeeded: - requires: - - javascript_lint_and_tests +# build_frontend: +# when: +# or: +# - <> +# - <> +# jobs: +# - javascript_lint_and_tests +# - all_circleci_checks_succeeded: +# requires: +# - javascript_lint_and_tests - build_backend: - when: - or: - - <> - - <> - jobs: - - e2e_tests: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - - win_e2e_tests: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - filters: - branches: - only: - - main - - demo - - unit_tests: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - - win_unit_tests: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - filters: - branches: - only: - - main - - demo - - lint: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - - all_circleci_checks_succeeded: - requires: - - e2e_tests - - unit_tests - - lint +# build_backend: +# when: +# or: +# - <> +# - <> +# jobs: +# - e2e_tests: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# - win_e2e_tests: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# filters: +# branches: +# only: +# - main +# - demo +# - unit_tests: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# - win_unit_tests: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# filters: +# branches: +# only: +# - main +# - demo +# - lint: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# - all_circleci_checks_succeeded: +# requires: +# - e2e_tests +# - unit_tests +# - lint - release: - jobs: - - release_to_npm: - <<: *release_filter - - release_to_pypi: - <<: *release_filter +# release: +# jobs: +# - release_to_npm: +# <<: *release_filter +# - release_to_pypi: +# <<: *release_filter - daily: - triggers: - - schedule: - cron: '0 1 * * *' - filters: - branches: - only: - - main - jobs: - - e2e_tests: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - - win_e2e_tests: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - - unit_tests: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - - win_unit_tests: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - - lint: - matrix: - parameters: - python_version: ['3.7', '3.8', '3.9', '3.10'] - - javascript_lint_and_tests +# daily: +# triggers: +# - schedule: +# cron: '0 1 * * *' +# filters: +# branches: +# only: +# - main +# jobs: +# - e2e_tests: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# - win_e2e_tests: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# - unit_tests: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# - win_unit_tests: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# - lint: +# matrix: +# parameters: +# python_version: ['3.7', '3.8', '3.9', '3.10'] +# - javascript_lint_and_tests diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml new file mode 100644 index 0000000000..41840c8c97 --- /dev/null +++ b/.github/workflows/check-release.yml @@ -0,0 +1,107 @@ +name: Check version and prepare release + +on: + push: + branches: + - main + +jobs: + check-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install requests + + - name: Check package version + run: python tools/github_actions/check_version.py + + - name: Set outputs + id: version_check + run: | + echo "new_release=${{ env.NEW_RELEASE }}" >> $GITHUB_OUTPUT + echo "package_name=${{ env.PACKAGE_NAME }}" >> $GITHUB_OUTPUT + echo "package_version=${{ env.PACKAGE_VERSION }}" >> $GITHUB_OUTPUT + + outputs: + new_release: ${{ steps.version_check.outputs.new_release }} + package_name: ${{ steps.version_check.outputs.package_name }} + package_version: ${{ steps.version_check.outputs.package_version }} + + # test: + # needs: check-version + # if: ${{ needs.check-version.outputs.new_release == 'true' }} + # uses: ./.github/workflows/check-plugin.yml + # with: + # plugin: ${{ needs.check-version.outputs.package_name }} + + prepare-release: + needs: [check-version] + if: ${{ needs.check-version.outputs.new_release == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + + - name: Extract release notes from ${{needs.check-version.outputs.package_name}}/RELEASE.md + id: extract + run: | + python tools/github_actions/extract_release_notes.py \ + "RELEASE.md" \ + "Release ${{needs.check-version.outputs.package_version}}" + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{needs.check-version.outputs.package_name}}-${{needs.check-version.outputs.package_version}} + name: ${{needs.check-version.outputs.package_name}}-${{needs.check-version.outputs.package_version}} + body_path: release_body.txt + draft: false + prerelease: false + token: ${{ secrets.GH_TAGGING_TOKEN }} + + # build-publish: + # needs: [check-version] + # if: ${{ needs.check-version.outputs.new_release == 'true' }} + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - name: Set up Python + # uses: actions/setup-python@v3 + # with: + # python-version: '3.10' + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install build + # - name: Build package + # run: | + # export plugin=${{ needs.check-version.outputs.package_name }} + # make package + # - name: Extract release notes from ${{needs.check-version.outputs.package_name}}/RELEASE.md + # id: extract + # run: | + # python tools/github_actions/extract_release_notes.py \ + # "${{needs.check-version.outputs.package_name}}/RELEASE.md" \ + # "Release ${{needs.check-version.outputs.package_version}}" + # - name: Create GitHub Release + # uses: softprops/action-gh-release@v1 + # with: + # tag_name: ${{needs.check-version.outputs.package_name}}-${{needs.check-version.outputs.package_version}} + # name: ${{needs.check-version.outputs.package_name}}-${{needs.check-version.outputs.package_version}} + # body_path: release_body.txt + # draft: false + # prerelease: false + # token: ${{ secrets.GH_TAGGING_TOKEN }} diff --git a/RELEASE.md b/RELEASE.md index c287a896a8..1c9fe2cc31 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -8,6 +8,15 @@ Please follow the established format: ## Major features and improvements - Add support for displaying dataset statistics in the metadata panel. (#1472) +- Test something1. (#1471) +- Test something2. (#1470) + +## Bug fixes and other changes + +- No bugs to fix. (#1472) +- Test something3. (#1471) +- Test something4. (#1470) + # Release 6.3.5 diff --git a/demo-project/.version b/demo-project/.version index 9152abbe6c..2319a69f28 100644 --- a/demo-project/.version +++ b/demo-project/.version @@ -1 +1 @@ -6.3.4 \ No newline at end of file +6.3.5 \ No newline at end of file diff --git a/demo-project/lightsail.json b/demo-project/lightsail.json index f0d9e0c074..e5823f0164 100644 --- a/demo-project/lightsail.json +++ b/demo-project/lightsail.json @@ -2,7 +2,7 @@ "serviceName": "kedro-viz-live-demo", "containers": { "kedro-viz-live-demo": { - "image": "public.ecr.aws/g0x0s3o2/kedro-viz-live-demo:6.3.4", + "image": "public.ecr.aws/g0x0s3o2/kedro-viz-live-demo:6.3.5", "ports": { "4141": "HTTP" } diff --git a/package-lock.json b/package-lock.json index e37b515307..76376f248e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@quantumblack/kedro-viz", - "version": "6.3.4", + "version": "6.3.5", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 01a41eb9fe..4edb412bdc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@quantumblack/kedro-viz", - "version": "6.3.4", + "version": "6.3.5", "description": "Kedro-Viz is an interactive development tool for building data science pipelines with Kedro.", "main": "lib/components/app/index.js", "files": [ diff --git a/package/kedro_viz/__init__.py b/package/kedro_viz/__init__.py index ec3e43dfaa..ed7712b697 100644 --- a/package/kedro_viz/__init__.py +++ b/package/kedro_viz/__init__.py @@ -1,3 +1,3 @@ """Kedro plugin for visualising a Kedro pipeline""" -__version__ = "6.3.4" +__version__ = "6.3.5" diff --git a/tools/github_actions/check_version.py b/tools/github_actions/check_version.py new file mode 100644 index 0000000000..bc29a19fe2 --- /dev/null +++ b/tools/github_actions/check_version.py @@ -0,0 +1,45 @@ +import os +import re +import requests +from pathlib import Path + +VERSION_MATCHSTR = r'\s*__version__\s*=\s*"(\d+\.\d+\.\d+)"' +PACKAGE_PATH = "package/kedro_viz" + + +def get_package_version(base_path, package_path): + init_file_path = Path(base_path) / package_path / "__init__.py" + match_obj = re.search(VERSION_MATCHSTR, Path(init_file_path).read_text()) + return match_obj.group(1) + + +def is_package_version_valid(pypi_endpoint, package_name, package_version): + print(f"Check if {package_name} {package_version} is on pypi") + response = requests.get(pypi_endpoint, timeout=10) + if response.status_code == 404: + # Version doesn't exist on Pypi - do release + print(f"Starting the release of {package_name} {package_version}") + return True + else: + print(f"Skipped: {package_name} {package_version} already exists on PyPI") + return False + + +if __name__ == "__main__": + """Check if a package needs to be released""" + base_path = Path() + new_release = "false" + package_name = PACKAGE_PATH.split("/")[1] + package_version = get_package_version(base_path, PACKAGE_PATH) + pypi_endpoint = f"https://pypi.org/pypi/{package_name}/{package_version}/json/" + + if is_package_version_valid(pypi_endpoint, package_name, package_version): + new_release = "true" + + env_file = os.getenv("GITHUB_ENV") + with open(env_file, "a") as env_file: + env_file.write(f"NEW_RELEASE={new_release}\n") + if new_release == "true": + env_file.write( + f"PACKAGE_NAME={package_name}\nPACKAGE_VERSION={package_version}\n" + ) diff --git a/tools/github_actions/extract_release_notes.py b/tools/github_actions/extract_release_notes.py new file mode 100644 index 0000000000..2a3f077e26 --- /dev/null +++ b/tools/github_actions/extract_release_notes.py @@ -0,0 +1,40 @@ +import sys + + +def extract_section(filename, heading): + with open(filename, "r") as file: + lines = file.readlines() + + start_line, end_line = None, None + + for i, line in enumerate(lines): + if not start_line and line.startswith("##"): + start_line = i - 1 + elif start_line is not None and line.startswith("# "): + current_heading = line.strip("#").replace(":", "").strip() + if current_heading == heading: + end_line = i + break + + if start_line is not None: + if end_line is None: + end_line = len(lines) + section_lines = lines[start_line + 1 : end_line] + section = "".join(section_lines).strip() + return section + else: + return None + + +if __name__ == "__main__": + if len(sys.argv) != 3: + raise Exception("Usage: python extract_release_notes.py ") + + filename = sys.argv[1] + heading = sys.argv[2] + section = extract_section(filename, heading) + + if not section: + raise Exception(f"Section not found under the {heading} heading") + with open("release_body.txt", "w") as text_file: + text_file.write(section)