Build and Deploy Packages to NPM manually #11
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: Build and Deploy Packages to NPM manually | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-publish-to-npm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| ############################################################################# | |
| # common steps | |
| ############################################################################# | |
| - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
| - name: use node.js 24.x | |
| uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
| with: | |
| node-version: '24.x' | |
| registry-url: https://registry.npmjs.org/ # Needed for auth | |
| - name: yarn install | |
| run: | | |
| yarn install | |
| - name: validate config | |
| run: yarn backstage-cli config:check --lax | |
| - name: lint | |
| run: yarn backstage-cli repo lint | |
| - name: type checking and declarations | |
| run: yarn tsc:full | |
| - name: build | |
| run: yarn workspaces foreach --all -v --no-private run build | |
| - name: verify type dependencies | |
| run: yarn tsc:full && yarn lint:all | |
| ############################################################################# | |
| # publish a plugin to npm | |
| ############################################################################# | |
| - name: change infrakitchen plugin version to `semver-sha` for PR | |
| working-directory: ./plugins/infrakitchen | |
| run: | | |
| VERSION=$(npm pkg get version --workspaces=false | tr -d \") | |
| if [ "${{ github.ref }}" == "refs/heads/main" ]; then | |
| npm pkg set version=$VERSION | |
| else | |
| npm pkg set version=$VERSION-$(echo ${{ github.sha }} | cut -c 1-7) | |
| fi | |
| - name: publish | |
| run: | | |
| yarn config set -H 'npmAuthToken' "${{secrets.NPM_TOKEN}}" | |
| yarn workspaces foreach -v -A --no-private npm publish --access public --tolerate-republish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |