diff --git a/.github/workflows/test-release-scripts.yml b/.github/workflows/test-release-scripts.yml index 8f3954f1745a8..5700ef99fe586 100644 --- a/.github/workflows/test-release-scripts.yml +++ b/.github/workflows/test-release-scripts.yml @@ -329,3 +329,77 @@ jobs: git branch --show-current | grep "^experiment/20210123-test" || false cat autoware.proj.repos | grep autoware/autoware.iv -A3 | grep "version: experiment/20210123-test" || false cat autoware.proj.repos | grep autoware/launcher -A3 | grep "version: experiment/20210123-test" || false + + test-eva-release: + needs: vcs-import-cache + runs-on: ubuntu-latest + container: osrf/ros:foxy-desktop + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install yq + run: | + apt-get -y update + apt-get -y install wget + wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.9.1/yq_linux_amd64 + chmod +x /usr/local/bin/yq + + - name: Fix eva_plugins.repos for private repositories + run: | + sed -i -e "s|git@github.com:|https://github.com/|g" eva_plugins.repos + + - name: Set git config for private repositories + run: | + git config --local --unset-all http.https://github.com/.extraheader || true + git config --global url.https://${{ secrets.REPO_TOKEN }}@github.com.insteadof 'https://github.com' + + - name: Run vcs import + run: | + mkdir src + vcs import src < eva_plugins.repos + + - name: Fix eva_plugins.repos for private repositories + run: | + sed -i -e "s|git@github.com:|https://github.com/|g" eva_plugins.repos + + - name: Commit eva_plugins.repos to remove workspace diff + run: | + git add eva_plugins.repos + git config --global user.email "actions@example.com" + git config --global user.name "Github Actions" + git commit -m "Update eva_plugins.repos in CI" + + - name: Set git config for private repositories + run: | + git config --local --unset-all http.https://github.com/.extraheader || true + git config --global url.https://${{ secrets.REPO_TOKEN }}@github.com.insteadof 'https://github.com' + + - name: Create rc branches + run: | + ./scripts/release/eva_create_product_rc_branches.sh -y v0.0.0 + + - name: Print versions + run: | + git branch + cat eva_plugins.repos + vcs custom src --git --args branch + + - name: Check result + run: | + cat eva_plugins.repos | grep proj_launcher -A3 | grep "version: rc/v0.0.0" || false + + - name: Create release tags + run: | + ./scripts/release/eva_create_product_release_tags.sh -y v0.0.0 + + - name: Print versions + run: | + git branch + cat eva_plugins.repos + vcs custom src --git --args branch + + - name: Check result + run: | + cat eva_plugins.repos | grep proj_launcher -A3 | grep "version: v0.0.0" || false diff --git a/scripts/release/eva_create_product_rc_branches.sh b/scripts/release/eva_create_product_rc_branches.sh new file mode 100755 index 0000000000000..4af7a54cfdf48 --- /dev/null +++ b/scripts/release/eva_create_product_rc_branches.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$(readlink -f "$(dirname "$0")") +source "$SCRIPT_DIR/common/helper_functions.sh" + +# Override functions +function get_repos_file_path() { + echo "$(git rev-parse --show-toplevel)/eva_plugins.repos" +} + +function get_product_repositories() { + find src/eva -type d -name '\.git' -print0 | xargs -0 -I {} dirname "{}" +} + +# Define functions +function show_usage() { + echo -e + "Usage: create_reference_rc_branches.sh product_version + [-h/--help] [-y/--yes] [--change-reference-repositories] [--push|--delete] + + -h/--help: + Show usage and exit. + + -y/--yes: + Proceed without confirmation. + + --change-reference-repositories: + Whether to create branches/tags in reference repositories. + + --push: + Whether to push branches/tags. Please use this option when you can be sure. + + --delete: + Whether to delete branches/tags. Please use this option when you mistook something. + + product_version: + The version to be used for product rc branches. + The valid pattern is '^v([0-9]+)\.([0-9]+)\.([0-9]+)$'. + + Note: Using --push and --delete at the same time may cause unexpected behaviors." +} + +# Parse arguments +source "$SCRIPT_DIR/common/parse_common_args.sh" +product_version="${args[0]}" + +# Check args +if ! is_valid_product_rc_version "$product_version"; then + echo -e "\e[31mPlease input a valid product rc version as the 2nd argument\e[m" + show_usage + exit 1 +fi + +# Run pre common tasks +source "$SCRIPT_DIR/common/pre_common_tasks.sh" + +# Set branch prefix +branch_prefix="rc/" + +# Create branches in product repositories +echo -e "\e[36mCreate branches in product repositories\e[m" +for product_repository in $(get_product_repositories); do + create_branch "$product_repository" "$branch_prefix$product_version" "$flag_push" "$flag_delete" +done + +# Run post common tasks +if [ "$flag_delete" = "" ]; then + source "$SCRIPT_DIR/common/post_common_tasks.sh" +fi diff --git a/scripts/release/eva_create_product_release_tags.sh b/scripts/release/eva_create_product_release_tags.sh new file mode 100755 index 0000000000000..6095d3b7ffcec --- /dev/null +++ b/scripts/release/eva_create_product_release_tags.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$(readlink -f "$(dirname "$0")") +source "$SCRIPT_DIR/common/helper_functions.sh" + +# Override functions +function get_repos_file_path() { + echo "$(git rev-parse --show-toplevel)/eva_plugins.repos" +} + +function get_product_repositories() { + find src/eva -type d -name '\.git' -print0 | xargs -0 -I {} dirname "{}" +} + +# Define functions +function show_usage() { + echo -e "Usage: create_product_release_tags.sh product_version + [-h/--help] [-y/--yes] [--change-reference-repositories] [--push|--delete] + + -h/--help: + Show usage and exit. + + -y/--yes: + Proceed without confirmation. + + --change-reference-repositories: + Whether to create branches/tags in reference repositories. + + --push: + Whether to push branches/tags. Please use this option when you can be sure. + + --delete: + Whether to delete branches/tags. Please use this option when you mistook something. + + product_version: + The version to be used for product release tags. + The valid pattern is '^v([0-9]+)\.([0-9]+)\.([0-9]+)$'. + + Note: Using --push and --delete at the same time may cause unexpected behaviors." +} + +# Parse arguments +source "$SCRIPT_DIR/common/parse_common_args.sh" +product_version="${args[0]}" + +# Check args +if ! is_valid_product_release_version "$product_version"; then + echo -e "\e[31mPlease input a valid product release version as the 2nd argument\e[m" + show_usage + exit 1 +fi + +# Run pre common tasks +source "$SCRIPT_DIR/common/pre_common_tasks.sh" + +# Create tags in product repositories +echo -e "\e[36mCreate tags in product repositories\e[m" +for product_repository in $(get_product_repositories); do + create_tag "$product_repository" "$product_version" "$flag_push" "$flag_delete" +done + +# Run post common tasks +if [ "$flag_delete" = "" ]; then + source "$SCRIPT_DIR/common/post_common_tasks.sh" +fi diff --git a/scripts/release/eva_update_vcs_versions.sh b/scripts/release/eva_update_vcs_versions.sh new file mode 100755 index 0000000000000..fe83af1d8da92 --- /dev/null +++ b/scripts/release/eva_update_vcs_versions.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$(readlink -f "$(dirname "$0")") +source "$SCRIPT_DIR/common/helper_functions.sh" + +# Override functions +function get_repos_file_path() { + echo "$(git rev-parse --show-toplevel)/eva_plugins.repos" +} + +update_vcs_versions