#!/bin/bash git config user.email "jonathan.franco.2103@gmail.com" git config user.name "CI" git remote remove ci git remote add ci https://oauth2:"${PUBLISH_TOKEN}"@gitlab.com/rglw/public/apis/rglw_api.git git checkout main git reset --hard origin/main cargo install toml-cli cargo install rglw_bumper OLD_PACKAGE_VERSION=$(toml get Cargo.toml package.version --raw) OLD_DEPENDENCIES_VERSION=$(toml get Cargo.toml workspace.package.version --raw) LAST_COMMIT=$(git log -1 | tr --delete "\n") PACKAGE_VERSION=$(rglw_bumper commit="${LAST_COMMIT}" version="${OLD_PACKAGE_VERSION}") DEPENDENCIES_VERSION=$(rglw_bumper commit="${LAST_COMMIT}" version="${OLD_DEPENDENCIES_VERSION}") toml set Cargo.toml package.version "${PACKAGE_VERSION}" > Cargo.toml.modified mv Cargo.toml.modified Cargo.toml toml set Cargo.toml workspace.package.version "${DEPENDENCIES_VERSION}" > Cargo.toml.modified mv Cargo.toml.modified Cargo.toml ROOT=$(pwd) CODEGEN=${ROOT}/rglw_api_codegen COMMON=${ROOT}/rglw_api_common CORE=${ROOT}/rglw_api_core sed -i "s/version = \"${OLD_DEPENDENCIES_VERSION}\"/version = \"${DEPENDENCIES_VERSION}\"/g" "${CODEGEN}"/Readme.md sed -i "s/version = \"${OLD_DEPENDENCIES_VERSION}\"/version = \"${DEPENDENCIES_VERSION}\"/g" "${COMMON}"/Readme.md sed -i "s/version = \"${OLD_DEPENDENCIES_VERSION}\"/version = \"${DEPENDENCIES_VERSION}\"/g" "${CORE}"/Readme.md sed -i "s/version = \"${OLD_PACKAGE_VERSION}\"/version = \"${PACKAGE_VERSION}\"/g" Readme.md git add . git commit -m "Release Version ${PACKAGE_VERSION}" git push ci main git tag -a "${PACKAGE_VERSION}" -m "Release Version ${PACKAGE_VERSION}" git push ci --tags