diff --git a/.github/workflows/manual-release-next.yml b/.github/workflows/manual-release-next.yml index b27cfe3741..f371c2635f 100644 --- a/.github/workflows/manual-release-next.yml +++ b/.github/workflows/manual-release-next.yml @@ -13,6 +13,9 @@ on: add_minor: description: 'add minor number' type: boolean + version: + description: 'specific a version' + type: 'string' jobs: get-plugins: @@ -118,10 +121,11 @@ jobs: git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>' echo "packages/pro-plugins" >> .git/info/exclude - bash release.sh $IS_FEAT $ADD_MINOR + bash release.sh $VERSION $IS_FEAT $ADD_MINOR env: PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.beta-plugins }} CUSTOM_PRO_PLUGIN_REPOS: ${{ needs.get-plugins.outputs.custom-plugins }} + VERSION: ${{ inputs.version && '--version ${{ inputs.version }}' || '' }} IS_FEAT: ${{ inputs.is_feat && '--is-feat' || '' }} ADD_MINOR: ${{ inputs.add_minor && '--add-minor' || '' }} - name: Push and merge into next diff --git a/release.sh b/release.sh index 80152ca599..f8b9e2505d 100755 --- a/release.sh +++ b/release.sh @@ -2,42 +2,47 @@ branch=$(git branch --show-current) current_version=$(jq -r '.version' lerna.json) IFS='.-' read -r major minor patch label pre <<< "$current_version" -if [ "$branch" == "main" ]; then - # rc - if [ "$1" == '--is-feat' ]; then - new_version="$major.$minor.0" - echo $new_version; - else - new_patch=$((patch + 1)) - new_version="$major.$minor.$new_patch" - echo $new_version; - fi -elif [ "$branch" == "next" ]; then - # beta - if [ "$1" == '--is-feat' ]; then - if [ "$2" == '--add-minor' ]; then - minor=$((minor + 1)) - fi - new_version="$major.$minor.0-beta.1" - echo $new_version; - else - new_pre=$((pre + 1)) - new_version="$major.$minor.$patch-beta.$new_pre" - echo $new_version; - fi -elif [ "$branch" == "develop" ]; then - # alpha - if [ "$1" == '--is-feat' ]; then - new_minor=$((minor + 1)) - new_version="$major.$new_minor.0-alpha.1" - echo $new_version; - else - new_pre=$((pre + 1)) - new_version="$major.$minor.$patch-alpha.$new_pre" - echo $new_version; - fi +if [ "$1" == '--version' ];then + new_version="$2" + echo $new_version; else - exit 1 + if [ "$branch" == "main" ]; then + # rc + if [ "$1" == '--is-feat' ]; then + new_version="$major.$minor.0" + echo $new_version; + else + new_patch=$((patch + 1)) + new_version="$major.$minor.$new_patch" + echo $new_version; + fi + elif [ "$branch" == "next" ]; then + # beta + if [ "$1" == '--is-feat' ]; then + if [ "$2" == '--add-minor' ]; then + minor=$((minor + 1)) + fi + new_version="$major.$minor.0-beta.1" + echo $new_version; + else + new_pre=$((pre + 1)) + new_version="$major.$minor.$patch-beta.$new_pre" + echo $new_version; + fi + elif [ "$branch" == "develop" ]; then + # alpha + if [ "$1" == '--is-feat' ]; then + new_minor=$((minor + 1)) + new_version="$major.$new_minor.0-alpha.1" + echo $new_version; + else + new_pre=$((pre + 1)) + new_version="$major.$minor.$patch-alpha.$new_pre" + echo $new_version; + fi + else + exit 1 + fi fi lerna version $new_version --preid alpha --force-publish=* --no-git-tag-version -y