Publish package #161
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: Publish package | |
| on: | |
| # push: | |
| # branches: | |
| # - main | |
| workflow_dispatch: | |
| inputs: | |
| package-names: | |
| description: Comma-separated list of package names (e.g. "typescript,python" or single "typescript") | |
| type: string | |
| dry-run: | |
| description: Dry run (no publish) | |
| type: boolean | |
| default: true | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Set matrix | |
| id: set-matrix | |
| run: | | |
| # Split comma-separated package names into JSON array | |
| IFS=',' read -ra PACKAGES <<< "${{ inputs.package-names }}" | |
| # Trim whitespace and create JSON array | |
| JSON="[" | |
| for i in "${!PACKAGES[@]}"; do | |
| PKG=$(echo "${PACKAGES[$i]}" | xargs) | |
| if [ $i -gt 0 ]; then | |
| JSON+="," | |
| fi | |
| JSON+="\"$PKG\"" | |
| done | |
| JSON+="]" | |
| echo "matrix=$JSON" >> $GITHUB_OUTPUT | |
| npm-publish: | |
| needs: prepare | |
| strategy: | |
| matrix: | |
| package-name: ${{ fromJson(needs.prepare.outputs.matrix) }} | |
| uses: ast-grep/langs/.github/workflows/release.yml@main | |
| with: | |
| directory: packages/${{ matrix.package-name }} | |
| dry-run: ${{ inputs.dry-run }} | |
| secrets: | |
| NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} |