publish to github npm registry #2
Workflow file for this run
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: Pre-release Package | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Update version with commit SHA | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| COMMIT_SHA=$(git rev-parse --short HEAD) | |
| NEW_VERSION="${PACKAGE_VERSION}-${COMMIT_SHA}" | |
| npm version --no-git-tag-version "${NEW_VERSION}" | |
| echo "Package version updated to ${NEW_VERSION}" | |
| - name: Create npm package | |
| run: pnpm pack | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: argocd-mcp-server | |
| path: argocd-mcp-server-*.tgz | |
| retention-days: 7 | |
| - name: Setup npm registry authentication | |
| run: | | |
| echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc | |
| - name: Publish to GitHub Packages | |
| run: npm publish --registry=https://npm.pkg.github.com | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |