Publish yume-dsl-rich-text #4
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 yume-dsl-rich-text | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version bump type" | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| - custom | |
| custom_version: | |
| description: "Custom version (only when type = custom, e.g. 1.2.3)" | |
| required: false | |
| type: string | |
| dry_run: | |
| description: "Dry run (skip actual publish)" | |
| required: false | |
| type: boolean | |
| default: false | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build & Test | |
| run: npm test | |
| - name: Bump version | |
| run: | | |
| if [ "${{ inputs.version }}" = "custom" ]; then | |
| if [ -z "${{ inputs.custom_version }}" ]; then | |
| echo "::error::custom_version is required when version type is 'custom'" | |
| exit 1 | |
| fi | |
| npm version "${{ inputs.custom_version }}" --no-git-tag-version | |
| else | |
| npm version "${{ inputs.version }}" --no-git-tag-version | |
| fi | |
| echo "PKG_VERSION=$(node -p 'require("./package.json").version')" >> "$GITHUB_ENV" | |
| - name: Publish | |
| if: ${{ !inputs.dry_run }} | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish (dry run) | |
| if: ${{ inputs.dry_run }} | |
| run: npm publish --access public --dry-run | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Commit version bump | |
| if: ${{ !inputs.dry_run }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add package.json | |
| git commit -m "release: yume-dsl-rich-text v${PKG_VERSION}" | |
| git tag "dsl-v${PKG_VERSION}" | |
| git push | |
| git push --tags |