From bdabbf083521de044181afe9f2b0de486b373b14 Mon Sep 17 00:00:00 2001 From: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> Date: Thu, 2 Feb 2023 14:42:49 +0000 Subject: [PATCH] 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. --- .github/workflows/release.yml | 13 +++++-------- tools/ci-scripts/upgrade-gradle-properties | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 99517b65c..b49064017 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 + echo "Pushing upgraded gradle.properties commit..." + git push origin release: name: Release diff --git a/tools/ci-scripts/upgrade-gradle-properties b/tools/ci-scripts/upgrade-gradle-properties index 5ba010b24..8e65369e1 100755 --- a/tools/ci-scripts/upgrade-gradle-properties +++ b/tools/ci-scripts/upgrade-gradle-properties @@ -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 -- GitLab