@@ -181,12 +181,18 @@ jobs:
181181 ref : ${{ inputs.commit_sha }}
182182 path : smithy-rs
183183 token : ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
184+ fetch-depth : 0
184185 - name : Generate release artifacts
185186 uses : ./smithy-rs/.github/actions/docker-build
186187 with :
187188 action : generate-smithy-rs-release
188189 - name : Download all artifacts
189190 uses : ./smithy-rs/.github/actions/download-all-artifacts
191+ # This step is not idempotent, as it pushes release artifacts to the `smithy-rs-release-1.x.y` branch. However,
192+ # if this step succeeds but a subsequent step fails, retrying the release workflow is "safe" in that it does not
193+ # create any inconsistent states; this step would simply fail because the release branch would be ahead of `main`
194+ # due to previously pushed artifacts.
195+ # To successfully retry a release, revert the commits in the release branch that pushed the artifacts.
190196 - name : Push smithy-rs changes
191197 shell : bash
192198 working-directory : smithy-rs-release/smithy-rs
@@ -202,7 +208,7 @@ jobs:
202208 # to retry a release action execution that failed due to a transient issue.
203209 # In that case, we expect the commit to be releasable as-is, i.e. the changelog should have already
204210 # been processed.
205- git fetch --unshallow
211+ git fetch
206212 if [[ "${DRY_RUN}" == "true" ]]; then
207213 # During dry-runs, "git push" without "--force" can fail if smithy-rs-release-x.y.z-preview is behind
208214 # smithy-rs-release-x.y.z, but that does not matter much during dry-runs.
@@ -214,18 +220,7 @@ jobs:
214220 fi
215221 fi
216222 echo "commit_sha=$(git rev-parse HEAD)" > $GITHUB_OUTPUT
217- - name : Tag release
218- uses : actions/github-script@v7
219- with :
220- github-token : ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
221- script : |
222- const createReleaseScript = require("./smithy-rs/.github/workflows/release-scripts/create-release.js");
223- await createReleaseScript({
224- github,
225- isDryRun: ${{ inputs.dry_run }},
226- releaseManifestPath: "smithy-rs-release/smithy-rs-release-manifest.json",
227- releaseCommitish: "${{ steps.push-changelog.outputs.commit_sha }}"
228- });
223+ # This step is idempotent; the `publisher` will not publish a crate if the version is already published on crates.io.
229224 - name : Publish to crates.io
230225 shell : bash
231226 working-directory : smithy-rs-release/crates-to-publish
@@ -247,7 +242,23 @@ jobs:
247242 else
248243 publisher publish -y --location .
249244 fi
245+ # This step is not idempotent and MUST be performed last, as it will generate a new release in the `smithy-rs`
246+ # repository with the release tag that is always unique and has an increasing numerical suffix.
247+ - name : Tag release
248+ uses : actions/github-script@v7
249+ with :
250+ github-token : ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
251+ script : |
252+ const createReleaseScript = require("./smithy-rs/.github/workflows/release-scripts/create-release.js");
253+ await createReleaseScript({
254+ github,
255+ isDryRun: ${{ inputs.dry_run }},
256+ releaseManifestPath: "smithy-rs-release/smithy-rs-release-manifest.json",
257+ releaseCommitish: "${{ steps.push-changelog.outputs.commit_sha }}"
258+ });
250259
260+ # If this step fails for any reason, there's no need to retry the release workflow, as this step is auxiliary
261+ # and the release itself was successful. Instead, manually trigger `backport-pull-request.yml`.
251262 open-backport-pull-request :
252263 name : Open backport pull request to merge the release branch back to main
253264 needs :
0 commit comments