npm registry #6
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: release | ||
| run-name: release ${{ inputs.tag }} | ||
| on: | ||
| Uncomment to test your work as a release before it's merged | ||
| push: | ||
| branches: | ||
| - improvement/CLDSRVCLT-7 | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Tag to be released (e.g., 1.0.0)' | ||
| required: true | ||
| jobs: | ||
| build-and-publish: | ||
| name: Build and publish to GitHub Packages | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup and Build | ||
| uses: ./.github/actions/setup-and-build | ||
| - name: Update package version | ||
| run: | | ||
| # Update version in package.json | ||
| npm version ${{ inputs.tag }} --no-git-tag-version | ||
| - name: Configure package for GitHub Packages | ||
| run: | | ||
| # Add publishConfig to package.json for GitHub Packages | ||
| node -e " | ||
| const pkg = require('./package.json'); | ||
| pkg.publishConfig = { | ||
| registry: 'https://npm.pkg.github.com' | ||
| }; | ||
| require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); | ||
| " | ||
| - name: Setup .npmrc for authentication | ||
| run: | | ||
| echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc | ||
| echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com" >> .npmrc | ||
| - name: Publish to GitHub Packages | ||
| run: npm publish | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Create Git Tag | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| git tag ${{ inputs.tag }} | ||
| git push origin ${{ inputs.tag }} | ||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ inputs.tag }} | ||
| name: Release ${{ inputs.tag }} | ||
| draft: false | ||
| prerelease: false | ||
| generate_release_notes: true | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||