| 1 | name: Reusable Release Workflow |
| 2 | |
| 3 | on: |
| 4 | workflow_call: |
| 5 | inputs: |
| 6 | package-name: |
| 7 | required: true |
| 8 | type: string |
| 9 | package-path: |
| 10 | required: true |
| 11 | type: string |
| 12 | secrets: |
| 13 | SEMANTIC_RELEASE_GITHUB_TOKEN: |
| 14 | required: true |
| 15 | SEMANTIC_RELEASE_NPM_TOKEN: |
| 16 | required: true |
| 17 | |
| 18 | permissions: |
| 19 | contents: write |
| 20 | issues: write |
| 21 | pull-requests: write |
| 22 | |
| 23 | jobs: |
| 24 | release: |
| 25 | name: Release ${{ inputs.package-name }} |
| 26 | runs-on: ubuntu-latest |
| 27 | defaults: |
| 28 | run: |
| 29 | working-directory: ${{ inputs.package-path }} |
| 30 | steps: |
| 31 | - name: Checkout |
| 32 | uses: actions/checkout@v4 |
| 33 | with: |
| 34 | fetch-depth: 0 |
| 35 | |
| 36 | - name: Use Node.js from .nvmrc |
| 37 | uses: actions/setup-node@v4 |
| 38 | with: |
| 39 | node-version-file: ".nvmrc" |
| 40 | |
| 41 | - name: Install dependencies |
| 42 | run: npm ci |
| 43 | |
| 44 | - name: Build |
| 45 | run: npm run build |
| 46 | |
| 47 | - name: Run tests |
| 48 | run: npm test |
| 49 | |
| 50 | - name: Release |
| 51 | env: |
| 52 | GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} |
| 53 | NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} |
| 54 | NODE_AUTH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} |
| 55 | run: npx semantic-release |