Skip to content

#️⃣ Use current commit hash as semver pre-release version in package.json

Notifications You must be signed in to change notification settings

significantbit/nightly-versioning-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nightly Versioning Action

Use current commit hash as semver pre-release version in package.json.
For example, bump 1.0.0 to 1.0.0-a1b2c3d.

Example usage

name: Create nightly release

on: workflow_dispatch

jobs:
  publish:
    name: Publish package
    runs-on: ubuntu-latest
    permissions:
      packages: write
      contents: read
    steps:
      - uses: actions/checkout@v4

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

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

      - name: Publish package
        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.

- 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 }}

About

#️⃣ Use current commit hash as semver pre-release version in package.json

Resources

Stars

Watchers

Forks