diff --git a/.github/actions/publish-crates/action.yaml b/.github/actions/publish-crates/action.yaml index b6a7e25..b2eaf22 100644 --- a/.github/actions/publish-crates/action.yaml +++ b/.github/actions/publish-crates/action.yaml @@ -35,11 +35,6 @@ inputs: type: string description: 'Slack webhook to use for notifications.' required: true - version-suffix: - type: string - description: 'Suffix to add to the version of the crates.' - required: false - default: '' runs: @@ -74,15 +69,6 @@ runs: working-directory: ${{ inputs.workspace_path }} run: cargo login ${{ inputs.cargo_registry_token }} - - name: Add custom version suffix - if: ${{ inputs.version_suffix != '' }} - shell: 'bash -ex {0}' - working-directory: ${{ inputs.workspace_path }} - run: | - WORKSPACE_VERSION=$(cargo get workspace.package.version) - cargo workspaces version custom ${WORKSPACE_VERSION}-${{ inputs.version_suffix }} \ - --all --no-git-commit --force "*" --yes - - name: Release packages to crates.io shell: 'bash -ex {0}' working-directory: ${{ inputs.workspace_path }} diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 123f8ac..3c7f76d 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -162,6 +162,8 @@ jobs: # and take care of the proper caching to speed up CI. - name: Install Rust toolchain uses: moonrepo/setup-rust@v1 + with: + bins: 'cargo-workspaces,cargo-get' - name: Update Cargo.lock shell: 'bash -ex {0}' @@ -172,12 +174,28 @@ jobs: if [[ ${BRANCH} == *components* ]]; then COMPONENT="${BRANCH##*--}" COMPONENT_PATH=$(jq -r --arg component ${COMPONENT} '.packages | to_entries[] | select(.value.component == $component) | .key' ${{ inputs.config }}) - ( cd "${COMPONENT_PATH}" && cargo update --workspace ) + ( + cd "${COMPONENT_PATH}" + if [[ ${{ inputs.version-suffix }} != '' ]]; then + WORKSPACE_VERSION=$(cargo get workspace.package.version) + cargo workspaces version custom ${WORKSPACE_VERSION}-${{ inputs.version-suffix }} \ + --all --no-git-commit --force "*" --yes + fi + cargo update --workspace + ) else if [[ '${{ inputs.workspace-dirs }}' != '' ]]; then # In case of a one PR for multiple components # update Cargo.lock for all components using the workspace-dirs input. for WORKSPACE in ${{ inputs.workspace-dirs }} ; do - ( cd "${WORKSPACE}" && cargo update --workspace ) + ( + cd "${WORKSPACE}" + if [[ ${{ inputs.version-suffix }} != '' ]]; then + WORKSPACE_VERSION=$(cargo get workspace.package.version) + cargo workspaces version custom ${WORKSPACE_VERSION}-${{ inputs.version-suffix }} \ + --all --no-git-commit --force "*" --yes + fi + cargo update --workspace + ) done fi # Commit changes to Cargo.lock if any