Publish multicluster-sdk #14
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 multicluster-sdk | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_increment: | |
| description: "Version increment type" | |
| required: true | |
| default: "patch" | |
| type: choice | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| defaults: | |
| run: | |
| working-directory: frontend/packages/multicluster-sdk | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GH_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org/" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: frontend | |
| - name: Run tests | |
| run: npm run test | |
| - name: Run linting | |
| run: npm run lint | |
| - name: Update package version | |
| id: version_update | |
| run: | | |
| TAG="multicluster-sdk-$(npm version ${{ inputs.version_increment }} --no-workspaces-update | tail -1 )" | |
| echo "TAG=$(echo $TAG)" >> $GITHUB_ENV | |
| - name: Update package reference in frontend | |
| run: npm update @stolstron/multicluster-sdk | |
| working-directory: frontend | |
| - name: Build package | |
| run: npm run build | |
| - name: Test publish (dry run) | |
| run: npm publish --dry-run | |
| - name: Add and commit version update | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| default_author: github_actions | |
| message: Release ${{ env.TAG }} [skip ci] | |
| tag: ${{ env.TAG }} | |
| - name: Publish to npm | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |