fix: update var name #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish NPM Package | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version_type: | ||
| description: "Use PATCH for fixes, use MINOR for new features and use MAJOR for breaking changes" | ||
| required: true | ||
| default: 'patch' | ||
| type: choice | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| build: | ||
| if: ${{ github.actor != 'dependabot'}} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup Environment | ||
| uses: ./.github/actions/setup | ||
| - name: Lint code | ||
| run: npm run lint | ||
| - name: Format code | ||
| run: pnpm run format | ||
| - name: Build project | ||
| run: npm run build-ui | ||
| publish: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup Environment | ||
| uses: ./.github/actions/setup | ||
| - name: Build project | ||
| run: npm run build-ui | ||
| - name: Install semver | ||
| run: pnpm add -w semver | ||
| - name: Bump version | ||
| working-directory: packages/ui | ||
| id: bump | ||
| run: | | ||
| NEW_VERSION=$(node - << 'EOF' | ||
| const fs = require('fs'); | ||
| const semver = require('semver'); | ||
| const pkg = require('./package.json'); | ||
| pkg.version = semver.inc(pkg.version, process.env.BUMP); | ||
| fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2)); | ||
| console.log(pkg.version); | ||
| EOF | ||
| ) | ||
| echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
| env: | ||
| BUMP: ${{ github.event.inputs.version_type }} | ||
| - name: Read new version | ||
| id: version | ||
| working-directory: packages/ui | ||
| run: echo "BUMP_VERSION=$(node -p \"require('./package.json').version\")" >> $GITHUB_OUTPUT | ||
| - name: Get new version | ||
| id: version | ||
| working-directory: packages/ui | ||
| run: echo "Version is ${{ steps.version.outputs.BUMP_VERSION }}" | ||
| # - name: Commit version bump | ||
| # run: | | ||
| # git config --local user.email "action@github.com" | ||
| # git config --local user.name "GitHub Action" | ||
| # git add . | ||
| # git commit -m "chore: bump @orama/ui v${{ steps.version.outputs.NEW_VERSION }}" | ||
| # git tag "v${{ steps.version.outputs.NEW_VERSION }}" | ||
| # git push && git push --tags | ||
| # - name: Publish to NPM | ||
| # working-directory: packages/ui | ||
| # run: npm publish | ||
| # env: | ||
| # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| # - name: Create GitHub Release | ||
| # uses: actions/create-release@v1 | ||
| # env: | ||
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| # with: | ||
| # tag_name: v${{ steps.version.outputs.NEW_VERSION }} | ||
| # release_name: Release v${{ steps.version.outputs.NEW_VERSION }} | ||
| # body: | | ||
| # Release v${{ steps.version.outputs.NEW_VERSION }} | ||
| # Changes in this release: | ||
| # - Automated release from GitHub Actions | ||
| # draft: false | ||
| # prerelease: false | ||