Unverified Commit 74ab9100 authored by ysaito1001's avatar ysaito1001 Committed by GitHub
Browse files

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._
parent 55faed73
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# This workflow performs a dry run for smithy-rs release. It can be triggered via either cron or manually.
# When ran, it only produces release artifacts, but will not cut a release tag in GitHub or publish to crates.io.

name: Smithy-rs dry run release
run-name: ${{ github.workflow }} ${{ inputs.commit_sha == ''  && 'scheduled' || (inputs.commit_sha) }}
on:
  schedule:
    # Runs 00:00 UTC every day
  - cron: 0 0 * * *
  workflow_dispatch:
    inputs:
      commit_sha:
        description: |
          Commit SHA: The SHA of the git commit that you want to release.
          You must use the non-abbreviated SHA (e.g. b2318b0 won't work!).
          Alternatively, you can use the name of a branch.
        required: true
        type: string

jobs:
  smithy-rs-manual-dry-run-release:
    name: Manual dry run release
    if: ${{ github.event_name == 'workflow_dispatch' }}
    uses: ./.github/workflows/release.yml
    with:
      commit_sha: ${{ inputs.commit_sha }}
      dry_run: true
    secrets:
      RELEASE_AUTOMATION_BOT_PAT: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
      RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN: ${{ secrets.RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN }}

  smithy-rs-scheduled-dry-run-release:
    name: Scheduled dry run release
    if: ${{ github.event_name == 'schedule' }}
    uses: ./.github/workflows/release.yml
    with:
      commit_sha: main
      dry_run: true
    secrets:
      RELEASE_AUTOMATION_BOT_PAT: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
      RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN: ${{ secrets.RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN }}
+29 −0
Original line number Diff line number Diff line
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# This workflow performs a production smithy-rs release. It will cut a release tag in GitHub and publish to crates.io.
# It is idempotent (e.g. won't publish the same crates to crates.io twice), so we can run it repeatedly until it succeeds.

name: Smithy-rs prod release
run-name: ${{ github.workflow }} (${{ inputs.commit_sha }})
on:
  workflow_dispatch:
    inputs:
      commit_sha:
        description: |
          Commit SHA: The SHA of the git commit that you want to release.
          You must use the non-abbreviated SHA (e.g. b2318b0 won't work!).
          Alternatively, you can use the name of a branch.
        required: true
        type: string

jobs:
  smithy-rs-prod-release:
    name: Prod release
    uses: ./.github/workflows/release.yml
    with:
      commit_sha: ${{ inputs.commit_sha }}
      dry_run: false
    secrets:
      RELEASE_AUTOMATION_BOT_PAT: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
      RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN: ${{ secrets.RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN }}
+10 −10
Original line number Diff line number Diff line
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

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

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

name: Release smithy-rs
run-name: ${{ inputs.dry_run && 'Dry run' || 'Prod run' }} - ${{ github.workflow }} (${{ inputs.commit_sha }})
on:
  workflow_dispatch:
  workflow_call:
    inputs:
      commit_sha:
        description: |
          Commit SHA: The SHA of the git commit that you want to release.
          You must use the non-abbreviated SHA (e.g. b2318b0 won't work!).
        description: The SHA of the git commit that you want to release.
        required: true
        type: string
      dry_run:
        description: |
          Dry run: When selected, it only produces release artifacts, but will not cut a release tag in GitHub or publish to crates.io
        description: When true, it only produces release artifacts, but will not cut a release tag in GitHub or publish to crates.io.
        required: true
        type: boolean
        default: true
    secrets:
      RELEASE_AUTOMATION_BOT_PAT:
        required: true
      RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN:
        required: true

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