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: Allow versioning non-published packages #20

Merged
merged 3 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
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
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ steps:
There are a few parameters that can be set to customize the behavior of the
action, they are all optional.

| Parameter | Default | Description |
|---------------------------|-----------------------|-----------------------------------------------------------|
| melos-version | latest | The version of Melos to activate. |
| run-bootstrap | true | Whether to run `melos bootstrap` after activating Melos. |
| enforce-lockfile | false | Whether the versions in the lockfiles should be enforced. |
| run-versioning | false | Whether packages should be versioned. |
| run-versioning-prerelease | false | Whether packages should be versioned as a prerelease. |
| publish-dry-run | false | Whether packages should be dry-run published. |
| publish | false | Whether packages should be published to pub.dev. |
| create-pr | false | Whether to create a PR with the changes made by Melos. |
| tag | false | Whether tags for the packages should be created. |
| git-email | [email protected] | The email to use when committing changes. |
| git-name | Melos Action | The name to use when committing changes. |
| Parameter | Default | Description |
|---------------------------|-----------------------|------------------------------------------------------------------|
| melos-version | latest | The version of Melos to activate. |
| run-bootstrap | true | Whether to run `melos bootstrap` after activating Melos. |
| enforce-lockfile | false | Whether the versions in the lockfiles should be enforced. |
| run-versioning | false | Whether packages should be versioned. |
| run-versioning-prerelease | false | Whether packages should be versioned as a prerelease. |
| include-private | false | Whether to include or exclude packages with `publish_to: "none"` |
| publish-dry-run | false | Whether packages should be dry-run published. |
| publish | false | Whether packages should be published to pub.dev. |
| create-pr | false | Whether to create a PR with the changes made by Melos. |
| tag | false | Whether tags for the packages should be created. |
| git-email | [email protected] | The email to use when committing changes. |
| git-name | Melos Action | The name to use when committing changes. |

To set a specific parameter you use the `with` keyword in your action, like in
the example below.
Expand Down
10 changes: 7 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
description: 'Whether packages should be versioned as a prerelease (default: false)'
required: false
default: 'false'
include-private:
description: 'Whether to include or exclude packages with `publish_to: "none"` (default: false)'
required: false
default: 'false'
publish-dry-run:
description: 'Whether packages should be dry-run published (default: false)'
required: false
Expand Down Expand Up @@ -73,11 +77,11 @@ runs:
shell: bash
- name: 'Run melos version'
if: ${{ inputs.run-versioning == 'true' }}
run: melos version --yes --no-git-tag-version
run: melos version --yes --no-git-tag-version ${{ (inputs.include-private == 'true' && '--all') || '' }}
shell: bash
- name: 'Run melos version as a prerelease'
if: ${{ inputs.run-versioning-prerelease == 'true' }}
run: melos version --yes --no-git-tag-version --prerelease
run: melos version --yes --no-git-tag-version --prerelease ${{ (inputs.include-private == 'true' && '--all') || '' }}
shell: bash
- name: 'Run melos publish (dry run)'
if: ${{ inputs.publish-dry-run == 'true' }}
Expand All @@ -95,7 +99,7 @@ runs:
run: |
# We don't care about errors due to creating new tags (`|| true`)
# since for all packages that didn't get a new release, the tag already exists.
melos exec -c 1 --no-private -- git tag \$MELOS_PACKAGE_NAME-v\$MELOS_PACKAGE_VERSION || true
melos exec -c 1 ${{ (inputs.include-private == 'true' && '--private') || '--no-private' }} -- git tag \$MELOS_PACKAGE_NAME-v\$MELOS_PACKAGE_VERSION || true
git push --tags
shell: bash
- name: 'Extract tag info'
Expand Down
2 changes: 1 addition & 1 deletion examples/01-workflow-dispatch/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
tag: true
- run: |
melos exec -c1 --no-published --no-private --order-dependents -- \
melos exec -c 1 --no-published --no-private --order-dependents -- \
gh workflow run release-publish.yml \
--ref \$MELOS_PACKAGE_NAME-v\$MELOS_PACKAGE_VERSION
env:
Expand Down
2 changes: 1 addition & 1 deletion examples/02-release-on-pr/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
tag: true
- run: |
melos exec -c1 --no-published --no-private --order-dependents -- \
melos exec -c 1 --no-published --no-private --order-dependents -- \
gh workflow run release-publish.yml \
--ref \$MELOS_PACKAGE_NAME-v\$MELOS_PACKAGE_VERSION
env:
Expand Down