chore(ci): change changeset version command #15
This file contains 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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
mode: | |
description: "Release mode" | |
required: true | |
default: "no publish" | |
type: choice | |
options: | |
- "no publish" | |
- "publish" | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
- name: Install Dependencies | |
run: npm ci | |
- name: Get Package Version | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
- name: No Publish Build and Pack | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.mode == 'no publish' }} | |
run: | | |
npm run build | |
npm pack | |
- name: No Publish Artifact Upload | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.mode == 'no publish' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: package-artifact | |
path: prettier-plugin-embed-${{steps.package-version.outputs.current-version}}.tgz | |
retention-days: 1 | |
overwrite: true | |
- name: Create Release Pull Request or Publish to npm | |
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.mode == 'publish') }} | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: npm run bump | |
publish: npx changeset publish | |
commit: "chore(release): v${{steps.package-version.outputs.current-version}}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |