Loading .github/workflows/claim-crate-names.yml 0 → 100644 +81 −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 claims the names of the unpublished crates in this repository # on crates.io (by publishing a dummy empty package) # Allow only one release to run at a time concurrency: group: release-smithy-rs cancel-in-progress: true env: rust_version: 1.62.1 name: Release smithy-rs run-name: ${{ github.workflow }} on: # It runs daily, but it can also be triggered on demand. workflow_dispatch: schedule: - cron: 0 11 * * * # run at 11:00 UTC (morning) every day jobs: main-branch-check: name: Check that workflow is running in main runs-on: ubuntu-latest steps: - name: Main branch check if: ${{ github.ref_name != 'main' }} uses: actions/github-script@v6 with: script: | core.setFailed("This workflow can only be ran on main (current branch: ${{ github.ref_name }})") # This job will be a no-op if an image was already built on main by another workflow. acquire-base-image: name: Acquire Base Image needs: - main-branch-check runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: path: smithy-rs fetch-depth: 0 - name: Acquire base image id: acquire run: ./smithy-rs/tools/ci-build/acquire-build-image - name: Upload base image uses: actions/upload-artifact@v3 with: name: smithy-rs-base-image path: smithy-rs-base-image retention-days: 1 claim: name: Claim crate names needs: - acquire-base-image runs-on: ubuntu-latest steps: - name: Install Rust uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.rust_version }} - name: Checkout smithy-rs uses: actions/checkout@v3 with: path: smithy-rs token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }} - name: Publish to crates.io shell: bash working-directory: smithy-rs-release/crates-to-publish env: RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN: ${{ secrets.RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN }} run: | cargo login -- "${RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN}" cargo install --path "$(realpath ../smithy-rs/tools/publisher)" # Verify the publisher tool installed successfully publisher --version publisher claim-crate-names -y tools/publisher/Cargo.lock +7 −0 Original line number Diff line number Diff line Loading @@ -348,6 +348,12 @@ dependencies = [ "percent-encoding", ] [[package]] name = "fs-err" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541" [[package]] name = "futures" version = "0.3.24" Loading Loading @@ -958,6 +964,7 @@ dependencies = [ "clap", "crates_io_api", "dialoguer", "fs-err", "handlebars", "lazy_static", "pretty_assertions", Loading tools/publisher/Cargo.toml +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ cargo_toml = "0.10.1" clap = { version = "~3.1.18", features = ["derive"] } crates_io_api = "0.7.3" dialoguer = "0.8" fs-err = "2" handlebars = "4.2" lazy_static = "1" regex = "1.5.4" Loading @@ -34,7 +35,7 @@ tokio = { version = "1.20.1", features = ["full"] } toml = { version = "0.5.8", features = ["preserve_order"] } tracing = "0.1.29" tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } tempfile = "3.3.0" [dev-dependencies] pretty_assertions = "1.2.1" tempfile = "3.3.0" tools/publisher/src/fs.rs +12 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,18 @@ impl Fs { Fs::Real => tokio_write_file(path.as_ref(), contents).await, } } /// Recursively create a directory and all of its parent components if they are missing. pub async fn create_dir_all(&self, path: impl AsRef<Path>) -> Result<()> { match self { Fs::Real => tokio_create_dir_all(path.as_ref()).await, } } } async fn tokio_create_dir_all(path: &Path) -> Result<()> { tokio::fs::create_dir_all(path).await?; Ok(()) } async fn tokio_read_file(path: &Path) -> Result<Vec<u8>> { Loading tools/publisher/src/lib.rs +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ pub const RUST_SDK_CI_OWNER: &str = "aws-sdk-rust-ci"; pub mod cargo; pub mod fs; pub mod package; pub mod publish; pub mod retry; pub mod sort; pub mod subcommand; Loading
.github/workflows/claim-crate-names.yml 0 → 100644 +81 −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 claims the names of the unpublished crates in this repository # on crates.io (by publishing a dummy empty package) # Allow only one release to run at a time concurrency: group: release-smithy-rs cancel-in-progress: true env: rust_version: 1.62.1 name: Release smithy-rs run-name: ${{ github.workflow }} on: # It runs daily, but it can also be triggered on demand. workflow_dispatch: schedule: - cron: 0 11 * * * # run at 11:00 UTC (morning) every day jobs: main-branch-check: name: Check that workflow is running in main runs-on: ubuntu-latest steps: - name: Main branch check if: ${{ github.ref_name != 'main' }} uses: actions/github-script@v6 with: script: | core.setFailed("This workflow can only be ran on main (current branch: ${{ github.ref_name }})") # This job will be a no-op if an image was already built on main by another workflow. acquire-base-image: name: Acquire Base Image needs: - main-branch-check runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: path: smithy-rs fetch-depth: 0 - name: Acquire base image id: acquire run: ./smithy-rs/tools/ci-build/acquire-build-image - name: Upload base image uses: actions/upload-artifact@v3 with: name: smithy-rs-base-image path: smithy-rs-base-image retention-days: 1 claim: name: Claim crate names needs: - acquire-base-image runs-on: ubuntu-latest steps: - name: Install Rust uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.rust_version }} - name: Checkout smithy-rs uses: actions/checkout@v3 with: path: smithy-rs token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }} - name: Publish to crates.io shell: bash working-directory: smithy-rs-release/crates-to-publish env: RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN: ${{ secrets.RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN }} run: | cargo login -- "${RELEASE_AUTOMATION_BOT_CRATESIO_TOKEN}" cargo install --path "$(realpath ../smithy-rs/tools/publisher)" # Verify the publisher tool installed successfully publisher --version publisher claim-crate-names -y
tools/publisher/Cargo.lock +7 −0 Original line number Diff line number Diff line Loading @@ -348,6 +348,12 @@ dependencies = [ "percent-encoding", ] [[package]] name = "fs-err" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541" [[package]] name = "futures" version = "0.3.24" Loading Loading @@ -958,6 +964,7 @@ dependencies = [ "clap", "crates_io_api", "dialoguer", "fs-err", "handlebars", "lazy_static", "pretty_assertions", Loading
tools/publisher/Cargo.toml +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ cargo_toml = "0.10.1" clap = { version = "~3.1.18", features = ["derive"] } crates_io_api = "0.7.3" dialoguer = "0.8" fs-err = "2" handlebars = "4.2" lazy_static = "1" regex = "1.5.4" Loading @@ -34,7 +35,7 @@ tokio = { version = "1.20.1", features = ["full"] } toml = { version = "0.5.8", features = ["preserve_order"] } tracing = "0.1.29" tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } tempfile = "3.3.0" [dev-dependencies] pretty_assertions = "1.2.1" tempfile = "3.3.0"
tools/publisher/src/fs.rs +12 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,18 @@ impl Fs { Fs::Real => tokio_write_file(path.as_ref(), contents).await, } } /// Recursively create a directory and all of its parent components if they are missing. pub async fn create_dir_all(&self, path: impl AsRef<Path>) -> Result<()> { match self { Fs::Real => tokio_create_dir_all(path.as_ref()).await, } } } async fn tokio_create_dir_all(path: &Path) -> Result<()> { tokio::fs::create_dir_all(path).await?; Ok(()) } async fn tokio_read_file(path: &Path) -> Result<Vec<u8>> { Loading
tools/publisher/src/lib.rs +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ pub const RUST_SDK_CI_OWNER: &str = "aws-sdk-rust-ci"; pub mod cargo; pub mod fs; pub mod package; pub mod publish; pub mod retry; pub mod sort; pub mod subcommand;