Publish #9
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: | |
workflow_run: | |
workflows: [CI] | |
branches: [main] | |
types: [completed] # Attiva quando il workflow CI è completato | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
publish: | |
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }} # Verifica che CI sia completato con successo e l'evento sia un push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
registry-url: https://registry.npmjs.org/ | |
- name: Install dependencies | |
run: npm ci | |
- name: Create and publish a release with changesets | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: npx changeset publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |