Skip to content

Commit

Permalink
Update release-v2.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yvasyliev authored Nov 15, 2023
1 parent 5584c1f commit da3a5e9
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions .github/workflows/release-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ jobs:
runs-on: ubuntu-latest
needs: [ get-current-version, validate-current-version ]
outputs:
new-version: ${{ steps.get-new-version.outputs.new-version }}
new-version: ${{ steps.increment-patch-version.outputs.new-version || steps.increment-minor-version.outputs.new-version || steps.increment-major-version.outputs.new-version || env.CURRENT_VERSION }}
env:
CURRENT_VERSION: ${{ needs.get-current-version.outputs.current-version }}
steps:
- name: Increment patch version
id: increment-patch-version
if: github.event.inputs.release_type == 'patch'
run: |
patch_version=$(echo "$CURRENT_VERSION" | grep -oP "^\d+\.\d+\.\K\d+")
Expand All @@ -109,8 +110,13 @@ jobs:
patch_version=$((patch_version + 1))
echo "incremented_patch_version=patch_version"
echo "New patch version is \`$patch_version\`" >> "$GITHUB_STEP_SUMMARY"
echo "NEW_VERSION=$(echo "$CURRENT_VERSION" | grep -oP '^\d+\.\d+\.')$patch_version" >> "$GITHUB_ENV"
new_version="$(echo "$CURRENT_VERSION" | grep -oP '^\d+\.\d+\.')$patch_version"
echo "New version is \`$new_version\`" >> "$GITHUB_STEP_SUMMARY"
new_version="new-version=$new_version"
echo "$new_version"
echo "$new_version" >> "$GITHUB_OUTPUT"
- name: Increment minor version
id: increment-minor-version
if: github.event.inputs.release_type == 'minor'
run: |
minor_version=$(echo "$CURRENT_VERSION" | grep -oP "^\d+\.\K\d+")
Expand All @@ -119,8 +125,13 @@ jobs:
minor_version=$((minor_version + 1))
echo "incremented_minor_version=$minor_version"
echo "New minor version is \`$minor_version\`" >> "$GITHUB_STEP_SUMMARY"
echo "NEW_VERSION=$(echo "$CURRENT_VERSION" | grep -oP '^\d+\.')$minor_version.0" >> $GITHUB_ENV
new_version="$(echo "$CURRENT_VERSION" | grep -oP '^\d+\.')$minor_version.0"
echo "New version is \`$new_version\`" >> "$GITHUB_STEP_SUMMARY"
new_version="new-version=$new_version"
echo "$new_version"
echo "$new_version" >> "$GITHUB_OUTPUT"
- name: Increment major version
id: increment-major-version
if: github.event.inputs.release_type == 'major'
run: |
major_version=$(echo "$CURRENT_VERSION" | grep -oP "^\d+")
Expand All @@ -129,24 +140,26 @@ jobs:
major_version=$((major_version + 1))
echo "incremented_major_version=$major_version"
echo "New major version is \`$major_version\`" >> "$GITHUB_STEP_SUMMARY"
echo "NEW_VERSION=$major_version.0.0" >> $GITHUB_ENV
new_version="$major_version.0.0"
echo "New version is \`$new_version\`" >> "$GITHUB_STEP_SUMMARY"
new_version="new-version=$new_version"
echo "$new_version"
echo "$new_version" >> "$GITHUB_OUTPUT"
- name: Set provided version
id: set-provided-version
if: github.event.inputs.release_type == 'provided'
run: |
echo "Provided version is \`$CURRENT_VERSION\`"
echo "NEW_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
- name: Get new version
id: get-new-version
env:
NEW_VERSION: ${{ env.NEW_VERSION }}
run: |
echo "new_version=$NEW_VERSION"
echo "New version is \`$NEW_VERSION\`" >> "$GITHUB_STEP_SUMMARY"
echo "new-version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
echo "Provided version is \`$CURRENT_VERSION\`" >> "$GITHUB_STEP_SUMMARY"
new_version=$CURRENT_VERSION
echo "New version is \`$new_version\`" >> "$GITHUB_STEP_SUMMARY"
new_version="new-version=$new_version"
echo "$new_version"
echo "$new_version" >> "$GITHUB_OUTPUT"
commit-new-version:
runs-on: ubuntu-latest
needs: [ get-current-version,get-new-version ] #TODO: add perform-tests
if: false #TODO: remove if
env:
CURRENT_VERSION: ${{ needs.get-current-version.outputs.current-version }}
NEW_VERSION: ${{ needs.get-new-version.outputs.new-version }}
Expand Down

0 comments on commit da3a5e9

Please sign in to comment.