Skip to content

Commit

Permalink
feat: support version from input
Browse files Browse the repository at this point in the history
  • Loading branch information
miii committed Aug 22, 2024
1 parent cd38f69 commit 3b23c50
Show file tree
Hide file tree
Showing 9 changed files with 478 additions and 1,167 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test

on:
push:
branches:
- v2

jobs:
release-please:
name: Create nightly version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4

- name: Get version candidate from release-please
id: release-please
run: npx release-please release-pr --dry-run --repo-url ${{ github.event.repository.full_name }} --token ${{ secrets.GITHUB_TOKEN }} --release-type node | grep -Po 'release \d.*' | grep -Po '\d.*' | xargs echo version= >> $GITHUB_OUTPUT

- name: Set nightly version
uses: significantbit/nightly-versioning-action@v2
with:
dry-run: true
version: ${{ steps.release-please.outputs.version }}
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm build
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Nightly Versioning Action

Use current commit hash as semver pre-release version in _package.json_.<br>
For example, bump `1.0.0-rc.0` to `1.0.0-rc.0.a1b2c3d`.
For example, bump `1.0.0` to `1.0.0-a1b2c3d`.

## Example usage

Expand All @@ -18,17 +18,28 @@ jobs:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3

- uses: pnpm/action-setup@v2
name: Install pnpm
uses: actions/setup-node@v4

- name: Set nightly version
uses: significantbit/nightly-versioning-action@v1
uses: significantbit/nightly-versioning-action@v2

- name: Publish package
run: pnpm publish --no-git-checks --tag next
run: npm publish --no-git-checks --tag next
```
## Example usage with release-please
You can run `release-please` in dry-run mode to determine the next version.
```yaml
- name: Run release-please
id: release-please
run: echo version=$(npx release-please release-pr --dry-run --repo-url ${{ github.event.repository.url }} --token ${{ secrets.GITHUB_TOKEN }} --release-type node | grep -Po 'release \d.*' | grep -Po '\d.*') >> $GITHUB_OUTPUT
- name: Set nightly version
uses: significantbit/nightly-versioning-action@v2
with:
dry-run: true
version: ${{ steps.release-please.outputs.version }}
```
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ inputs:
dry-run:
description: Whether to run the action without committing or pushing
required: false
default: false
version:
description: New version candidate to be used
required: false
outputs:
version:
description: New version generated by the action
Expand Down
Loading

0 comments on commit 3b23c50

Please sign in to comment.