Publish on Version Change #7
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: Publish on Version Change | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'package.json' | |
- 'packages/**/package.json' | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
registry-url: 'https://npm.pkg.github.com/' | |
scope: '@adaptate' | |
# - name: Configure .npmrc for GitHub Packages | |
# run: | | |
# echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc | |
# echo "@adaptate:registry=https://npm.pkg.github.com" >> ~/.npmrc | |
- name: Install dependencies | |
run: npm ci | |
- name: Build project | |
run: npx turbo run build | |
- name: Publish to GitHub Packages | |
working-directory: packages/core | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npm publish --registry=https://npm.pkg.github.com/ | |
- name: Publish to npm | |
working-directory: packages/core | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish --registry=https://registry.npmjs.org/ --access public |