Skip to content

Commit

Permalink
Persist the modified gradle.properties outside of the Docker context (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
LukeMathWalker authored Feb 2, 2023
1 parent 649f758 commit bdabbf0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
21 changes: 20 additions & 1 deletion tools/ci-scripts/upgrade-gradle-properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bdabbf0

Please sign in to comment.