Skip to content

Publish package

Publish package #161

Workflow file for this run

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}}