Skip to content

Commit 74ab910

Browse files
authored
Support daily dry run release (#3548)
## Motivation and Context Runs dry-run release workflow daily ## Description We've had quite a few instances where we discovered that a dry-run failed when we were about to release, by which time a good amount of code changes were accumulated in the `main` branch. That sometimes made it harder to investigate the underlying root cause, compared to if we had run dry-run daily. To alleviate the issue, this PR runs a dry-run release daily, ensuring that the `main` branch is in good shape to kick off a prod release and that we can react to a dry-run failure caused by a PR merged to the `main` the previous day. To make this happen, the existing release workflow `release.yml` has been converted to a reusable workflow (with `workflow_call`). This is because a scheduled workflow run cannot take inputs, making it difficult to pass `commit_sha` and the `dry_run` flag to it. With `release.yml` being a reusable workflow, we have two new workflows calling `release.yml`: `prod-release.yml` and `dry-run-release.yml`, both of which we can manually trigger and we can also trigger the latter via cron. Note that there is no longer a checkbox `dry-run` that used to exist in `release.yml`. Instead, we choose a corresponding workflow. ## Testing Verified the previous workflows continued to work: - manually triggered dry-run release - manually triggered prod release However, a scheduled dry-run has not been tested because we first need to check-in `dry-run-release.yml` to main for a scheduled workflow to kick-in. In other words, we'll do live test and see what happens (will fix if any issues come up). ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 55faed7 commit 74ab910

File tree

3 files changed

+83
-10
lines changed

3 files changed

+83
-10
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This workflow performs a dry run for smithy-rs release. It can be triggered via either cron or manually.
5+
# When ran, it only produces release artifacts, but will not cut a release tag in GitHub or publish to crates.io.
6+
7+
name: Smithy-rs dry run release
8+
run-name: ${{ github.workflow }} ${{ inputs.commit_sha == '' && 'scheduled' || (inputs.commit_sha) }}
9+
on:
10+
schedule:
11+
# Runs 00:00 UTC every day
12+
- cron: 0 0 * * *
13+
workflow_dispatch:
14+
inputs:
15+
commit_sha:
16+
description: |
17+
Commit SHA: The SHA of the git commit that you want to release.
18+
You must use the non-abbreviated SHA (e.g. b2318b0 won't work!).
19+
Alternatively, you can use the name of a branch.
20+
required: true
21+
type: string
22+
23+
jobs:
24+
smithy-rs-manual-dry-run-release:
25+
name: Manual dry run release
26+
if: ${{ github.event_name == 'workflow_dispatch' }}
27+
uses: ./.github/workflows/release.yml
28+
with:
29+
commit_sha: ${{ inputs.commit_sha }}
30+
dry_run: true
31+
secrets:
32+
RELEASE_AUTOMATION_BOT_PAT: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
33+
RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN: ${{ secrets.RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN }}
34+
35+
smithy-rs-scheduled-dry-run-release:
36+
name: Scheduled dry run release
37+
if: ${{ github.event_name == 'schedule' }}
38+
uses: ./.github/workflows/release.yml
39+
with:
40+
commit_sha: main
41+
dry_run: true
42+
secrets:
43+
RELEASE_AUTOMATION_BOT_PAT: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
44+
RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN: ${{ secrets.RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN }}

.github/workflows/prod-release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This workflow performs a production smithy-rs release. It will cut a release tag in GitHub and publish to crates.io.
5+
# It is idempotent (e.g. won't publish the same crates to crates.io twice), so we can run it repeatedly until it succeeds.
6+
7+
name: Smithy-rs prod release
8+
run-name: ${{ github.workflow }} (${{ inputs.commit_sha }})
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
commit_sha:
13+
description: |
14+
Commit SHA: The SHA of the git commit that you want to release.
15+
You must use the non-abbreviated SHA (e.g. b2318b0 won't work!).
16+
Alternatively, you can use the name of a branch.
17+
required: true
18+
type: string
19+
20+
jobs:
21+
smithy-rs-prod-release:
22+
name: Prod release
23+
uses: ./.github/workflows/release.yml
24+
with:
25+
commit_sha: ${{ inputs.commit_sha }}
26+
dry_run: false
27+
secrets:
28+
RELEASE_AUTOMATION_BOT_PAT: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
29+
RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN: ${{ secrets.RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN }}

.github/workflows/release.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# This workflow performs a release of smithy-rs. It is manually
5-
# kicked off via GitHub Actions workflow dispatch.
4+
# This is the shared release workflow run by both `prod-release.yml` and `dry-run-release.yml'.
5+
# A calling workflow will indicate whether it wants to run this with a prod run or a dry run.
66

77
# Allow only one release to run at a time
88
concurrency:
@@ -13,22 +13,22 @@ env:
1313
rust_version: 1.74.1
1414

1515
name: Release smithy-rs
16-
run-name: ${{ inputs.dry_run && 'Dry run' || 'Prod run' }} - ${{ github.workflow }} (${{ inputs.commit_sha }})
1716
on:
18-
workflow_dispatch:
17+
workflow_call:
1918
inputs:
2019
commit_sha:
21-
description: |
22-
Commit SHA: The SHA of the git commit that you want to release.
23-
You must use the non-abbreviated SHA (e.g. b2318b0 won't work!).
20+
description: The SHA of the git commit that you want to release.
2421
required: true
2522
type: string
2623
dry_run:
27-
description: |
28-
Dry run: When selected, it only produces release artifacts, but will not cut a release tag in GitHub or publish to crates.io
24+
description: When true, it only produces release artifacts, but will not cut a release tag in GitHub or publish to crates.io.
2925
required: true
3026
type: boolean
31-
default: true
27+
secrets:
28+
RELEASE_AUTOMATION_BOT_PAT:
29+
required: true
30+
RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN:
31+
required: true
3232

3333
jobs:
3434
check-actor-for-prod-run:

0 commit comments

Comments
 (0)