chore: configura release automático con changelog y publicación #4
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 & Publish | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org/' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build library | |
run: npm run ngx-notion-cms:build | |
- name: Replace ngx-notion-cms dependency with local file | |
run: | | |
jq '.dependencies["ngx-notion-cms"] = "file:dist/ngx-notion-cms"' package.json > tmp.json && mv tmp.json package.json | |
- name: Install with local ngx-notion-cms | |
run: npm install | |
- name: Generate release and changelog | |
run: npm run release:ci | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to npm | |
run: npm publish dist/ngx-notion-cms --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Push release commit and tag | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git push --follow-tags origin main |