Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add custom crates version suffix support #14

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ on:
description: 'Commit message for Cargo.lock update.'
required: false
default: 'chore: update Cargo.lock'
version-suffix:
type: string
description: 'Suffix to add to the version of the crates.'
required: false
default: ''
outputs:
releases_created:
description: "Whether release-please created a new GitHub releases."
Expand Down Expand Up @@ -157,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'

- name: Update Cargo.lock
shell: 'bash -ex {0}'
Expand All @@ -167,8 +174,17 @@ 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 )
else
COMPONENT_VERSION=$(jq -r ".${COMPONENT_PATH}" ${{ inputs.manifest }})
(
cd "${COMPONENT_PATH}"
if [[ '${{ inputs.version-suffix }}' != '' ]]; then
cargo workspaces version custom ${COMPONENT_VERSION}-${{ inputs.version-suffix }} \
--all --no-git-commit --force "*" --yes
fi
cargo update --workspace
)
fi
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
Expand Down
Loading