Unverified Commit bdabbf08 authored by Luca Palmieri's avatar Luca Palmieri Committed by GitHub
Browse files

Persist the modified gradle.properties outside of the Docker context (#2287)

* Fix if condition.

* Make sure that the changes are visible to the push step after the Docker action has executed by persisting the modified repository as an artifact.

* Give a name to the argument.
parent 649f7586
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -111,7 +111,6 @@ jobs:
      !contains(needs.*.result, 'cancelled')
    runs-on: ubuntu-latest
    outputs:
      commit_sha: ${{ steps.gradle-push.outputs.commit_sha }}
      release_branch: ${{ needs.get-or-create-release-branch.outputs.release_branch }}
    steps:
    - uses: actions/checkout@v3
@@ -124,20 +123,18 @@ jobs:
      with:
        action: upgrade-gradle-properties
        action-arguments: ${{ inputs.semantic_version }}
    - name: Download all artifacts
      uses: ./smithy-rs/.github/actions/download-all-artifacts
    - name: Push gradle.properties changes
      id: gradle-push
      working-directory: artifacts
      shell: bash
      env:
        SEMANTIC_VERSION: ${{ inputs.semantic_version }}
        DRY_RUN: ${{ inputs.dry_run }}
      run: |
        if git diff-index --quiet HEAD; then
          # The file was actually changed, we need to commit and push the changes
          git commit gradle.properties --message "Upgrade the smithy-rs runtime crates version to ${SEMANTIC_VERSION}"
        echo "Pushing upgraded gradle.properties commit..."
        git push origin
        fi
        echo "commit_sha=$(git rev-parse HEAD)" > $GITHUB_OUTPUT

  release:
    name: Release
+20 −1
Original line number Diff line number Diff line
@@ -6,4 +6,23 @@

set -eux

publisher upgrade-runtime-crates-version --version ${1} --gradle-properties-path smithy-rs/gradle.properties
SEMANTIC_VERSION="${1}"
SMITHY_RS_DIR="$(pwd)/smithy-rs"
ARTIFACTS_DIR="$(pwd)/artifacts"
mkdir -p "${ARTIFACTS_DIR}"

pushd "${SMITHY_RS_DIR}"
publisher upgrade-runtime-crates-version --version "${SEMANTIC_VERSION}"
if git diff-index --quiet HEAD; then
  # The file was actually changed, we need to commit the changes
  git commit gradle.properties --message "Upgrade the smithy-rs runtime crates version to ${SEMANTIC_VERSION}"
fi
popd

# Clone smithy-rs repo changes (changelog updates) into
# the `smithy-rs-release` artifact for push to GitHub
pushd "${ARTIFACTS_DIR}"
git clone "${SMITHY_RS_DIR}"
# Copy over the original remotes so that it's possible to push to `origin`
cp "${SMITHY_RS_DIR}/.git/config" .git/config
popd